Jump to content

1.3.5 tutte le lingue - BUG - impossibile caricare immagini


disarci

Recommended Posts

Direttamente da Bruno...nel bug tracker:
sostituire la funzione isPicture
nel file images.inc.php

http://www.prestashop.com/bug_tracker/view/6645/

/**
* Check image MIME type
*
* @param string $file $_FILE of the current file
* @param array $types Allowed MIME types
*/
function isPicture($file, $types = NULL)
{
   /* Detect mime content type */
   $mimeType = false;
   if (!$types)
       $types = array('image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png');
   /* Try 4 different methods to determine the mime type */
   if (function_exists('finfo_open'))
   {
       $const = defined('FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
       $finfo = finfo_open($const);
       $mimeType = finfo_file($finfo, $file['tmp_name']);
       finfo_close($finfo);
   }
   elseif (function_exists('mime_content_type'))
   {
       $mimeType = mime_content_type($file['tmp_name']);
   }
   elseif (function_exists('exec'))
   {
       $mimeType = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name'])));
       if (!$mimeType)
           $mimeType = trim(exec('file --mime '.escapeshellarg($file['tmp_name'])));
       if (!$mimeType)
           $mimeType = trim(exec('file -bi '.escapeshellarg($file['tmp_name'])));
   }
   if (empty($mimeType) OR $mimeType == 'regular file')
       $mimeType = $file['type'];
       /* For each allowed MIME type, we are looking for it inside the current MIME type */
   foreach ($types AS $type)
       if (strstr($mimeType, $type))
           return true;
       return false;
}

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