0

I have moved site to another server but some of the images are not showing on front and admin.they are available in folder.

Is there any solution to it?

2
  • Did you try File permission
    – Magento 2
    Commented Oct 10, 2017 at 5:09
  • save all product and try Commented Oct 10, 2017 at 5:12

4 Answers 4

0

connect your server via ssh and

go to magento root directory

and fire below two commands

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
0

First, check whether you are able to get the image by hitting the image URL in the browser directly.

I think you would be getting either 404 or 500 error while accessing the image directly by hitting their URLs in the browser.

If it is the case, just rename the .htaccess file under media folder, clear cache and recheck.

You can also check server's error log if above steps do not solve your problem.

Go to next steps, if above steps don't work for you.

Open any product for editing and upload another image. Assign all radio to that image. Save the product. Check if you are able to see the newly uploaded image.

If yes, then you need to change the owner of media and skin folders.

Please let me know if it helped.

0

@Mohit..hitting url in browser showing default magento image. if I upload image from backend than it shows. I have already tried changing .htaccess but that did not help.

0
0

Expending Murtuza's answer,

Murtuza's answer is a temporary solutions as this happens due to file permission, so assigning permission to every image you upload is really not a good idea, as for once you can assign permission for uploaded content on your media folder but what if you upload new images?

Many users faced this problem after installing patch SUPEE-8788 and SUPEE-7405, these patches tightens file permissions on images uploaded from the Magento admin dashboard. Before the patch, the Varien file uploader used 0777 permissions for image uploads. Part of the patch installation changes these permissions to 0640 for files and 0750 for directories, which means only the user and group on the server can read these files.

To fix this, a manual change is required on the file lib/Varien/File/Uploader.php to adjust the 0640/0750 permissions to 0644/0755.

To perform this fix, open the file:

lib/Varien/File/Uploader.php

Search for this line:

chmod($destinationFile, 0640);

And replace it with:

chmod($destinationFile, 0644);

And search for this line:

chmod($destinationFile, 0750);

and change it to:

chmod($destinationFile, 0755);

Save the file and refresh Magento’s cache. You should now be able to upload images correctly with permissions that the webserver can access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.