Jump to content

Making thumbs of images results in warning: exif_read_data(nameofpic): File not supported


KarlvonKarton
 Share

Recommended Posts

Hello, I'm filling an image field from an 3th party API with the Processwire API.

All goes well:
1. images are correctly uploaded in images field
2. the first image is correctly converted to a thumbnail and added to another field (thumbnails)
3. the script does not break

But: i get a warning like (example) on almost every picture (twice, what is more strange): exif_read_data(17-1.600x0.jpg): File not supported

What am I doing wrong?

My code:
 

$picture = $this->getImageAPI($pic['mediumUrl']['href'],$pic['rentalUnit']['objectID'].'-'.$pic['order']);
if($picture != ''){
$pictel++;
$p->oe_images->add('./'.$picture);
$lastPic = $p->oe_images->last();
unlink('./'.$picture);
$p->save();
}

if($pictel == 1){
$thumbnail = $lastPic->size(600,0);
$p->oe_thumbnails->add($thumbnail);
$p->save();
}

 

Link to comment
Share on other sites

I have been testing a bit more and I narrowed down the problem to just the size(600,0) part.
So when I take an image and make a thumbnail of it with size() , then I get an E_WARNING.
(I don't even have to save the thumbnail to another field)
But I still have no clue why this happens.

Link to comment
Share on other sites

I'm not sure, but maybe this is related: https://processwire.com/talk/topic/20006-module-restapi/?do=findComment&comment=176115

Quote

For instance, when running a PNG file through the PW ImageResizer ($img->size() etc), PW throws an exception, because the exif_read_data function is not available for PNG's. PW deals with this by using the error control operator (@method): the code still runs fine, while silently throwing an exception message.

I guess that only superusers see such messages, and regular editors don't.

  • Like 2
Link to comment
Share on other sites

20 hours ago, dragan said:

I'm not sure, but maybe this is related: https://processwire.com/talk/topic/20006-module-restapi/?do=findComment&comment=176115

I guess that only superusers see such messages, and regular editors don't.

I see the E_WARNING because of the PHP set_error_handler I use.  Which I log in a mysql table.
All the pictures are JPG, but maybe the "problem" is triggered by different camera models, I don't know.
I've asked the provider of the API, but they can not figure it out (yet).  I'm still waiting for their answer.

PS: I wouldn't mind so much if it were only an E_NOTICE...

Link to comment
Share on other sites

  • 9 months later...

HAving similar PHP warnings here

PHP Warning: exif_read_data(1-transf-kosk4-min.gif): File not supported in /home/m1698/Sites/processwire/site/modules/FileValidatorImage/FileValidatorImage.module:398

On this install I'm running images attached to a frontend form upload through the FileValidatorImage module which I installed first. This module uses PHP's exif_read_data function. And that doesn't seem to support gif. Couldn't find a list of supported file types in the PHP docs, though.

I don't really worry too much about the warning itself. Only the mails I get from Tracydebugger get annoying after a while ;-)
Just posting for reference.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...