Download & Extend

getimagesize() [function.getimagesize]: Read error! in image_gd_get_info()

Project:Open Enterprise
Version:7.x-1.0-rc3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

All the preloaded images including demo content cause this warning.

Notice: getimagesize() [function.getimagesize]: Read error! in image_gd_get_info() (line 349 of /var/www/html/adhesions/drupal/modules/system/image.gd.inc).

The resulting image file is only 2 bytes in size and invalid.

Can upload new images OK

Comments

#1

So how does one go about getting rid of this error?

#2

I receive the same error message.

#3

This manual patch works for me, it got rid of the message, and allows me to see which image file(s) caused the issue.

File to modify: var\modules\system\image.gd.inc
line 349

// $data = getimagesize($image->source); //was original line

$img = drupal_realpath($image->source);

if (filesize($img) > 10 )
{ $data = getimagesize($img);}

// this filters out files that have a size of less than x bytes which is probably a corrupted file.
// I found this original patch on http://drupal.org/node/1522348, but it didn't work because the filesize() function returns and int
// not a bool

#4

I have traced the error to problems with populating the demo content. It turns out that the image files imageX.png get copied to imageX_1.png (where X = {1,5}) and then even to imageX_2.png and imageX_3.png while playing with the enable/disable the demo content. However, for some reason the png files which are typically 250k plus in size get truncated to 2 byte length files, which are of course invalid. The error message occurs when the properties of the file are unexpectedly invalid.

The patch above is a workaround. But the real problem seems to be why the files get copied to the ones with the _1 and _2, and why do they get clobbered?

#5

same case here

#6

create a patch according to comment#3

AttachmentSize
system_get-image-size_1678568.patch 607 bytes

#7

#6 patch did not work

#8

following this issue..

#9

I used jam.ing 's patch in #3 which cleared the message but sounds like a bug needing a fix.. thanks for posting your experience here.. saved alot of time,..

#10

Try Configuration -> Image styles
Overridden the default setting

should work