Jump to content

Image problems


Recommended Posts

Hi,

Not sure if this should be here but wasnt too sure where to put it. I've searched the forums and i canot find the answer. I've had prestashop for a couple of months and have uploaded over 100 product images and manufacturer images to the site with no problem. Then today i tried to change the homepage editor logo and when i clicked upload the BO page disappears, leaving only the menus at the top, no confirmation to say it listed or the image was successful. I have since overridden that by putting the image i want in the editorial module.

But now when I've just tried to upload a picture for a product and it does the same thing. All the menus stay and the rest of the page disappears. this also happens when i try to change the category picture.

I've changed all permissions to 777 and still to no avail

The only things that have changed since are: I've used the CSV import (and export module) I've had an SSL certificate installed, and I've installed an image module (when the user goes over the picture it magnifys it) I believe this to be the cause but I'm not sure how to fix it

Thank you for your help in advance

Link to comment
Share on other sites

My guess is that you are uploading an image that is too big, which is causing the memory limit to be exceeded. You can edit config/config.inc.php and temporarily change 'display_errors' from 'off' to 'on' so that you get an error message instead of a blank area. Post the error message here.

Link to comment
Share on other sites

My guess is that you are uploading an image that is too big, which is causing the memory limit to be exceeded. You can edit config/config.inc.php and temporarily change 'display_errors' from 'off' to 'on' so that you get an error message instead of a blank area. Post the error message here.


Thank you for trying to help, I've put errors on andtried again and this is what I get

Warning: exec() has been disabled for security reasons in /home/compuhub/public_html/images.inc.php on line 82

Not sure what that means??

just had a look at the file and the code between lines 79 and 88 are as follows

elseif (function_exists('mime_content_type'))
       $mime_type = mime_content_type($file['tmp_name']);
   elseif (function_exists('exec'))
       $mime_type = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name'])));
   if (empty($mime_type) || $mime_type == 'regular file')
       $mime_type = $file['type'];
   if (($pos = strpos($mime_type, ';')) !== false)
       $mime_type = substr($mime_type, 0, $pos);
   // is it a picture ?
   return $mime_type && in_array($mime_type, $types);

Link to comment
Share on other sites

  • 3 months later...

Since I do not have access to my php.ini file (shared hosting account) and some functions have been disabled in the file. And as I understand it I cannot enable functions that have been disabled by using a custom php.ini file I chose I different method.

The issue is in the images.inc.php file located in the root of prestashop line 82

the exec() function is the issue yeah....

Notice that it is in a series of if statements. I guess that because it exists but is disabled that, when the function function_exists is called in the if statement, it tries to use it in the image upload process. Since it is in an if statement it would seem to me it is not required and that another method will be used if not. This is all some what speculative and I only looked at the code for a few minutes but anyway....

I just deleted this whole elseif and it all seems to work fine. I haven't tested extensively but I can upload images now and everything seems ok

i.e. delete

elseif (function_exists('exec'))
$mime_type = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name'])));

or you could try changing it to...

elseif (is_callable('exec'))
$mime_type = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name'])));

if you are uncomfortable with deleting this statement. I have not tested this I just understand that is_callable will take disabled functions in php.ini into consideration

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...