Jump to content

1 error 1. image format not recognized, allowed formats are: .gif, .jpg, .png


Recommended Posts

Hello Forum,

I had just upgraded from 1.3.2 to 1.3.4 on a system that I am about to go live with. It works well except the image upload (manufacturers, products, catalog categories).

I receive the error 1 error 1. image format not recognized, allowed formats are: .gif, .jpg, .png

When attempting an image upload.

The site shares a server with another prestashop install - version 1.3.1.1 which does not have the problem.

Nothing is displayed in the error_log

The permissions on the img and sub dirs is 777

Any ideas?

Some of the threads which show othes having similar problems suggest it to be permissions related or even suggest commenting parts of the images.inc.php file.

Does anyone have a suggestion?

Thank you

David

Link to comment
Share on other sites

Hello Razaro did you do this on version 1.3.4? Its' weird becasue my 1.3.2 version works great.

For me commenting these lines worked but I know it is not right solution
   //if (!isPicture($file))
   //    return Tools::displayError('image format not recognized, allowed formats are: .gif, .jpg, .png');

Link to comment
Share on other sites

Sorry, forgot to mention I did that for 1.3.2.3 version on my server, but didn't test it in any other version.

And yes i agree that is hack and it is not right solution.

Edit: just checked images.inc.php in 1.4.05 and function isPicture is different.

Link to comment
Share on other sites

Okay so you got the problem with 1.3.2.3 and I didn't with that version I only got it with 1.3.4. I might try your Hack or perhaps leave the site on 1.3.2 until version 1.4. Not sure what to do! :)

Sorry, forgot to mention I did that for 1.3.2.3 version on my server, but didn't test it in any other version.

And yes i agree that is hack and it is not right solution.

Edit: just checked images.inc.php in 1.4.05 and function isPicture is different.
Link to comment
Share on other sites

Hello,

Searching on internet I found a solution that I posted at the end of this bug report:

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

I don't know if it works for you. Let us know.


Thanks for link. I tried that solution and it didn't worked for me. (1.3.2.3)
Done some searching and tests and think I got other solution.

My PHP version is 5.2.14 and Fileinfo is not inculcated so first test from isPicture function is false.
Second one mime_content_type returns text/plain for png image and that seams cause problem, that few people had that function.
And third option trim(exec(... works for me so I just changed order to
    elseif (function_exists('exec'))
       $mime_type = trim(exec('file -b --mime-type '.escapeshellarg($file['tmp_name'])));
   elseif (function_exists('mime_content_type'))
       $mime_type = mime_content_type($file['tmp_name']);     



And it is working, for now at least :-)
Don't know about other PresatShop versions.

Link to comment
Share on other sites

Hi Fant63,

What version of PHP do you have?

Here is another solution. Does it works for you?

http://dtbaker.com.au/random-bits/prestashop-error-image-format-not-recognized-allowed-formats-are-.gif-.jpg-.png.html
// is it a picture ?
return $mime_type && in_array($mime_type, $types);
Change it to this:

$mime_type = preg_replace(’/;\scharset.*$/’,’’,$mime_type);
// is it a picture ?
return $mime_type && in_array($mime_type, $types);

Thank you,

Link to comment
Share on other sites

I have installed a fresh install on 1.3.4 and still get error "image format not recognized, allowed formats are: .gif, .jpg, .png"

when uploading any type of gif, jpg file.

I have downloaded again the latest zip file and uploaded images.inc.php again and still get this problem.

Link to comment
Share on other sites

@littlez,

Could you please give me an ftp access in Private Message to a prestashop folder with 1.3.5 installed? So we could debug the problem on your system configuration.

@chipset,

I don't think that smarty is involved. Because the error occurs when you upload a PNG for the logo of the shop. The file is not recognized as a PNG by the backOffice.

Regards,

Link to comment
Share on other sites

Yes thank you! it will help. An access to a new Prestashop 1.3.5 will be very nice. So we can finish with this png files not being recognized. It seems so basic to get that work, but there is so much version of PHP and Apache with each time small bugs. I now the same thing with Prestashop. That's the OpenSource software industry.

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