Jump to content

[SOLVED] Image upload in zip file fixed (for me) - more eyes please


!sense

Recommended Posts

I have been trying for a while now to get images uploaded the way they should work in prestashop. I do have 2 multi uploader modules, but none of them seem to work for me at the moment. Whenever I tried to upload a zip file with images in it, I would get the message that the file is not one of the accepted formats, jpg, png, etc.

 

I have made some changes that fixes it for me, but I would appreciate additional input from someone more skilled than me (about 95% of the people here!)

 

In images.inc.php you will find a function ==> function isPicture($file, $types = NULL) which determines whether the file is a picture or not.

 

I changed the following code:

 

if (count($name_explode) >= 2)
{
 $current_extension = strtolower($name_explode[count($name_explode)-1]);
 if (!in_array($current_extension, $authorized_extensions))
  return false;
}
else
 return false;

 

to become

 

if (count($name_explode) >= 2)
{
 $current_extension = strtolower($name_explode[count($name_explode)-1]);
 if (!in_array($current_extension, $authorized_extensions))
  return false;
}
else
 return true;

 

The original code would return false, regardless of whether it is a picture or not in the zip file.

This seem to solve my problem, as I can now zip a couple of pics into a file and upload that to get everything uploaded in one go.

 

This has been tested in PS 1.4.9.0

 

Am I breaking something even bigger doing this?

Edited by !sense (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 3 months later...

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...