Magento: "Image does not exist" - excel

I'm importing a CSV file in Magento (version 1.9).
I receive the error: 'Image does not exist'.
I've tried to do everything I could find on the internet.
The template I'm using for upload is the default template taken from my export folder.
I've added the / before the image name and I've also saved the file as UTF-8 format.
Any advice would help.

Use advanced profiler
System > Import/Export > Dataflow – Profiles
You only need to include the attributes that are required, which is just the SKU. Plus the appropiate image attributes. Plus labels if you want to go all out.
When you are creating your new profile, enter the following settings:
Now you can hit save! With our Profile now complete, we just need to create the folder media/import. This is where you will be storing all your images awaiting import.
When uploading images, they need to be within a folder called media/import. Once saved to that folder you can then reference them relatively. By that I mean if your image is in media/import/test.jpg in your csv reference it as /test.jpg. It’s as easy as that.
Please check this link for more information
Import products using csv
in the Default Import
first move all the images in media/import folder and then use '/imagename' in csv and then import.
And give the 777 permission to the import folder.
Let me know if you have any query....

check 3 point before upload csv file in Magento
create media > import folder and place all images inside import
folder import folder should have 777 permission
the path of images should be /desert-002.jpg

It may issue with image path in CSV if a image path in CSV is abg/test.jpg then it path in Dir is ..media/import/abg/test.jpg.also check image extension letter issue. Suppose your image extension I'd JPG and you rewrite in CSV is jpg .then it show image not exits

Your file template must look like this:
sku,image
product-001,/product_image.jpg
This file must exist: yourdocroot/media/import/product_image.jpg
More detail please read this method:
Mage_Catalog_Model_Convert_Adapter_Product::saveImageDataRow
You will see these lines:
$imageFile = trim($importData['_media_image']);
$imageFile = ltrim($imageFile, DS);
$imageFilePath = Mage::getBaseDir('media') . DS . 'import' . DS . $imageFile;
I hope this help!!!

Related

Flask: get uploaded image size and delete at the same time

I am making a small Flask web application . I have uploaded images in media/upload_images folder .Now I want to get the uploaded image size when I will click a button in client side and after getting the image size, meanwhile it will be aslo deleted from media/upload_images folder. How can I implement this? ... Any suggestion? Help will be appriciated. Thanks
First, you will need to import os module.
import os
To get the size of an uploaded file you can use like below:
os.stat('media/upload_images/filename.extension').st_size # This will give you the size in bytes.
To remove a file, you can use like below:
os.remove('media/upload_images/filename.extension')
I will suggest you, when you are deleting a file, do the proper error handling to avoid exceptions.
Update:
To get the size of each file in a directory:
files_list = os.listdir(app.config['UPLOADED_PHOTOS_DEST'])
for file in files_list:
size = os.stat(app.config['UPLOADED_PHOTOS_DEST'] + file)
print('Filename: ', file, ', Size: ', size)

Im am getting FileNotFoundError when trying to create a for in loop

I am making an image classifier. I have successfully created the folders and I manually placed the .txt files which has links to images from google inside each folder.
I am now trying to download the images from each .txt file either into a folder inside each folder category, or into each category folder that also has the .txt file, however i keep getting errors. please help.
I manually placed the .txt files in each of the folders as they was in the parent folder name as PLANTS but this has not made a difference.
I expected to get all the images downloaded in their respective folders from the .txt files with google image links but it is not working, whether the .txt is inside the main PLANTS FOLDER or inside each category folder which is inside the PLANTS folder
instead i get the below errors
FileNotFoundError
please see attached screen shot
&
Long filenames or paths with spaces are supported by NTFS in Windows NT. However, these filenames or directory names require quotation marks around them when they are specified in a command prompt operation. Failure to use the quotation marks results in the error message.
for i in range(len(folders)):
path = "content/gdrive/My Drive/Colab Notebooks/Flowers/PLANTS"
#for creating directory we need path class object so below this:
dest_for_creating_directory = path/folders[i]
#for searchi directory which have spaces we need doubleQuotations that
#why user below one in download image function instead of dest.
dest_for_searching_directory = path+"/"+folders[i]
Note: its better practice to write folder/file name without space more info

How To Upload Excel Data In Laravel?

I have problem with importing thousand data into phpMyAdmin. I do import and it just cause null. And I can't input it manually one by one. I need something helpful with that problem.
Thanks if you willing to help me.
As you named phpMyAdmin I guess the problem is importing to the database.
MySQLDumper can help you importing and exporting massive database files:
To use it:
Download it from this link: https://sourceforge.net/projects/mysqldumper/
Place the content inside your webspace. eg: the htdocs folder
Start the script in your browser (http://www.yourDomain.de/yourFolder/mysqldumper/). eg: localhost/mysqldumper
Follow the Installation assistent
From there you could import or export to an existent database or to a new one.
The solution is to enter it 200,200...:(with chunk)
Ex:
//path is the path of excel file uploaded ex: /excel/excel.xlx
Excel::filter('chunk')->load($path)->chunk(200, function($results)
{
});

How do you move the contents of a randomly named folder to a new location when you dont know what the folder name will be?

I am using requests to download an image with python. That part works ok. When I download a file I provide a name: sitea.zip . When that file is decompressed it contains a folder with a random name, something like ZX234564563SDSD, that has a qcow2 image in it named gw-vm.qcow2.
I need to move the gw-vm.qcow2 to a specific folder for each site that I download an image for.
I can't figure out how to cd into that randomly named folder to get at the gw-vm.qcow2 file.
Right now I am using os.system('unzip sitea.zip') to decompress.
I don't know how to cd into the resulting folder to then perform the following: os.system('mv gw-vm.qcow2 /opt/unetlab/addons/qemu/sc-branch-a-1.0/gw-vm.qcow2')
Any direction is appreciated.
It's going to be a function of os.walk() -- it performs a dirwalk on a directory. Check out the docs on it: https://docs.python.org/3/library/os.html?#os.walk
Good luck, hope that helps!
(edited formatting)

Can't get to exif data .JPG image

I'm trying to read the exif data from a .JPG image. I've tried differents solutions found here and there (PIL, piexif, exifread...) and none of them worked for this set of images. It worked for other images taken from another camera but not for this one, all these different methods returning empty dictionaries. It seems that there is no exif data but (I apologies for my newbyness) when I RIGHT-click + properties (I use windows), I do see what is exif data to me : date of creation, etc...
Here is one image :
image.JPG
If another of the thousands of anonymous heroes could help me on this one, I would be very grateful...
Alright so I found a solution which I share now.
The problem is that the libraries that open metadata are not taking all possible configurations for the image file and therefore, they can handle some and some others they cannot. I finally made it using exiftool, an executable that I dowloaded on my windows on this link :
https://sno.phy.queensu.ca/~phil/exiftool/
Then I paste the executable in a folder and I add exiftool.py in that folder, that I got from :
https://github.com/smarnach/pyexiftool/find/master
Then, using this small piece of code (for example):
import exiftool
with exiftool.ExifTool("exiftool.exe") as et:
metadata = et.get_metadata_batch(files)
for d in metadata:
print("{:20.20} {:20.20}".format(d["SourceFile"],
d["File:FileCreateDate"]))
Of course, this is just to show that you indeed can access the metadata, then you can do whatever you want with that. Here is the documentation of the library exiftool : http://smarnach.github.io/pyexiftool/
Cheers, JM

Resources