On node save the notice Notice: getimagesize() [function.getimagesize]: Read error! in image_gd_get_info() (line 349 of C:\wamp\www\store\modules\system\image.gd.inc)
is created and the thumbnail image does not show.
I have attached four images from the debugging program that include the variable values. The first two images, media_youtube_bug1.jpg and media_youtube_bug2.jpg are from when the youtube link is added through the media dialog and the user is returned to the node edit or node create page. The last two images, media_youtube_bug3.jpg and media_youtube_bug4.jpg, are from when the user clicks the save button on the node edit or node create form. I have no other information than the site being relatively vanilla and I'm using the latest dev version of Media and Media Youtube modules.
Comment | File | Size | Author |
---|---|---|---|
#40 | core-getimagesize_read_error-1522348-40.patch | 522 bytes | seanB |
#21 | core-getimagesize_read_error-1522348-21.patch | 587 bytes | jenlampton |
media_youtube_bug4.jpg | 198.45 KB | Adam S | |
media_youtube_bug3.jpg | 202.76 KB | Adam S | |
media_youtube_bug2.jpg | 211.04 KB | Adam S |
Comments
Comment #1
sethhill CreditAttribution: sethhill commentedGetting this too. As a workaround I changed the widget type to file and used it that way. It won't let you link to the content as easily in Views, but you can do a token replacement and link to node/[nid].
Comment #2
Christian Bj CreditAttribution: Christian Bj commentedi have the same problem
Comment #3
Adam S CreditAttribution: Adam S commentedI changed the field type to file and with the latest version of media.module it allows YouTube to be embedded.
Comment #4
aethr CreditAttribution: aethr commentedI chimed in with some details here, but the problem was a PEBCAC. I had selected the "Image" field type instead of File when setting up my content type, just as the other people above.
Comment #5
gooddesignusa CreditAttribution: gooddesignusa commentedI need to use image since it provides max and min sizes for images. I have a field set up to allow image uploads or youtube links.
Comment #6
VanD CreditAttribution: VanD commentedI am getting this error too, and using Media: YouTube with TinyMCE + WYSIWYG
EDIT: Mine is unrelated -- Error caused by disk being full
Comment #7
paddy_deburca CreditAttribution: paddy_deburca commentedIssue #681042: Notice when viewing an uploaded image of 0 bytes is a duplicate of this post. There is a suggested fix on line 349 of "modules/system/image.gd.inc" of
It seems that the proposed fix should be applied to D8 first, then ported to D7.
UPDATE:
Of course,
$image->source
is of the format public://image-name.type, and bothfile size()
andgetimagesize()
require a full path name. Another option is to use the functiondrupal_realpath()
asComment #8
ronanoutang CreditAttribution: ronanoutang commentedHi,
Please if you have the solution for Drupal 7 of this issue, help me... I fed up to see this message on my website
Comment #9
askandlearn CreditAttribution: askandlearn commentedI am getting this error on a fresh installation of the Open Enterprise distribution before I even try to upload anything. How might I go about tracking down the cause and fixing it?
Comment #10
ronanoutang CreditAttribution: ronanoutang commentedHi,
I am beginner in PHP and I test a simple solution and it seems to work :
Just add @ before getimagesize function in order to eliminate the error message (see below) :
function image_gd_get_info(stdClass $image) {
$details = FALSE;
$data = @getimagesize($image->source);
Comment #11
RobW CreditAttribution: RobW commentedLet me get some more info before I look into this further:
Comment #12
RobW CreditAttribution: RobW commentedBringing issue #1793526: gd getimagesize error here.
@druplicate, how is your file field set up? So far, I have been unable to reproduce this.
Comment #13
gooddesignusa CreditAttribution: gooddesignusa commentedCreate a Image Field and use 'Media file selector' for the widget. Inside the field settings check 'video' under 'Allowed remote media types' & enable youtube under 'Allowed URI schemes'.
Then turn on 'YouTube Preview Image' under '/admin/structure/file-types/manage/video/file-display/media_large'
Make sure the display fields is set to use that build mode. Add new content, use youtube link in the new field. save node and you will get that notice. Hope that helps recreate the notice.
Comment #14
RobW CreditAttribution: RobW commentedI believe the problem is using an image field instead of a file field. M:YT was built to use file entity, not image module.
I'd prefer to keep this module file field specific. Why aren't file fields working for you?
Comment #15
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedi am using a filefield and getting the error when the image did not upload properly.
#7 worked for me.
Comment #16
RobW CreditAttribution: RobW commented@SocialNicheGuru, can you paste the exact error, and steps to reproduce, versions being used if possible?
Comment #17
druplicate CreditAttribution: druplicate commentedI have an image field. I could use a file field but the goal was to allow mixed media so that images and video would display together in the same slideshow. There may be another way to accomplish that using two separate fields in the same content type but I'm not sure how to do it off the top of my head.
Comment #18
RobW CreditAttribution: RobW commented@Druplicate, that is the purpose of file field, and Media in general. You can set your file field to accept video and images; I would try this before looking for the source of image field errors.
Image field and non-image media providers like YouTube were never meant to work together. If file field is failing somewhere that image field isn't, we can try and fix file field, but overall this issue might be a "won't fix".
Comment #19
gooddesignusa CreditAttribution: gooddesignusa commentedSorry if I was unclear before. The reason I am using the Image field with the media selector widget is because I need the 'Minimum image resolution' option which will only show on an image field. I'm allowing youtube videos to be used in that field as well. If there was another way to add some type of field validation I would not need to use an Image field.
The notice is not a big deal since I shut off php notices when going live with the site so the end user never sees the message.
Comment #20
druplicate CreditAttribution: druplicate commentedI tried using a file field and a video from Youtube and that renders ok without the error, but an uploaded image will not display, only the file name/link. The field format is set to "rendered file". There may be a bug in filefield.
If I insert the short URL for a Youtube video via the "Web" tab, there are no errors and the video displays and plays fine, but if I first search for and select a video via the "Youtube" tab, I get this error:
Notice: Undefined index: #validators in media_youtube_add_validate() (line 258 of /usr/local/www/apache22/data/sites/all/modules/media_youtube/media_youtube.module)
The Youtube tab in Media is known to have some issues and I have read that it won't be included in the first stable release of Media 2.
Comment #21
jenlamptonUpdating project and status.
Please test this patch and let me know if it helps.
Comment #22
kaizerking CreditAttribution: kaizerking commentedthis patch did not work
Comment #23
vadbars@drupal.org CreditAttribution: vadbars@drupal.org commentedsubscribe
Comment #24
Alan Warren CreditAttribution: Alan Warren commentedPatch did not work for me either.
before patch
Notice: getimagesize() [function.getimagesize]: Read error! in image_gd_get_info() (line 350
after
Notice: getimagesize() [function.getimagesize]: Read error! in image_gd_get_info() (line 351 of
Probably something I have not configured?
Any help would be greatly appreciated..
Found the module.
For me it was Enterprise Blog Content. I will post there, but mercifully don't need it!
Comment #25
martinyde CreditAttribution: martinyde commentedThe patch in #21 solved my issue.
Using:
Drupal 7.17
Media 7.x-1.2
Media Vimeo 7.x-1.0-Beta5
Media Youtube 7.x-2.0-rc1
Comment #26
Barry Tielkes CreditAttribution: Barry Tielkes commentedImage is showing up when using:
Drupal 7.17
Media 7.x-2.0-unstable7
Media Youtube 7.x-2.0-rc1
media_translation 7.x-1.2
But i still get the notice. (
Comment #27
aaron CreditAttribution: aaron commentedI applied the patch, and it does not solve the error when I have a youtube setup on the image field.
Comment #28
everoll CreditAttribution: everoll commentedThe @ in front of getimagesize fixed mine also. Thanks!!
Comment #29
j0rd CreditAttribution: j0rd commentedso function image_gd_get_info($image) calls getimagesize() on $image->source.
When using media_youtube $image->source is set to something like "youtube://v/wTaXI9LUugc"
Get image size obviously doesn't understand this URL. Which is why it fails.
I assume this is a problem with either media or media_youtube passing in the wrong / invalid data to image_get_info().
Comment #30
Spartagus CreditAttribution: Spartagus commentedAny update on this error? I tried the patch with no luck.
I am using:
Drupal 7.22
Media 7.x-1.3
Media: YouTube 7.x-2.0-rc3
Comment #31
vacho CreditAttribution: vacho commentedthis problem in my case is for the permissions of files. this these should be at 777
Comment #32
b-a-l-d-e-r CreditAttribution: b-a-l-d-e-r commented• Patch did NOT work.
• #10 solved the issue for me
cheers
Comment #33
joco_sp CreditAttribution: joco_sp commented#21 worked for me
Comment #34
jenlamptonWith several successful reviews above, looks like this patch is RTBC.
I'm still applying this patch to 7.23 so would love to get it in :)
Comment #34.0
jenlamptonMy grammar sucks.
Comment #35
sgurlt CreditAttribution: sgurlt commented#21 didnt worked for me
#10 instead worked perfectly ! :)
Comment #36
geekyMoa CreditAttribution: geekyMoa commented#21 gave me this error instead:
Warning: filesize() [function.filesize]: stat failed for http://youtube.com/watch?v=Tk4vRF5djkk i image_gd_get_info() (line 350 of modules/system/image.gd.inc).
Comment #37
betoscopioComment #38
David_Rothstein CreditAttribution: David_Rothstein commentedIt sounds like testing results on the latest patch are mixed, and it also needs more review since e.g. j0rd's comment in #29 suggests it may not even be a bug in Drupal core...
If it is a bug in core, the fix would need to go into Drupal 8 first.
Comment #39
jenlamptonStill applying #21 to 7.25. If anyone else has any ideas as to where the problem might be caused, please post your ideas. I'm happy to do some more digging in D7.
I can't do any work on D8 since there's still a horrible core bug that prevents me from running it, so if this needs to be fixed first there then someone else will have to roll that patch :(
Comment #40
seanBI added a patch for the fix in #10.
Comment #41
rajeev_drupal CreditAttribution: rajeev_drupal commentedWorked for me.......Making status RTBT
Comment #42
fietserwinIn D8 this is (soon) going to be solved by #2211227: Refactor image and imagetoolkit: isExisting, isSupported, supportedTypes, getMimeType, so no need to first solve this issue in D8.
A few notes:
- What we do solve in D8 is just preventing the error message from appearing. As the method that calls getimagesize() returns false we expect the calling code to display a proper user oriented error message. This is in line with the patch in #40.
- getimagesize() can work with stream wrappers, so there is no need to use drupal_realpath to get the actual file name (patch in #21 is not needed). The Drupal stream wrappers do implement stream_stat() and url_stat() and so won't fail either. If stat() fails for the youtube stream wrapper (comment #36), that error message will also be prevented by the @. This is also in lien with the patch in #40.
So a +1 on RTBC for patch #40.
Comment #43
David_Rothstein CreditAttribution: David_Rothstein commentedAlright, thanks for that info. I think we can commit this now, due to the timing (but keep an eye on the Drupal 8 issue and forward-port this one-line change if something happens such that it becomes necessary).
Committed to 7.x - thanks!
Comment #45
David_Rothstein CreditAttribution: David_Rothstein commentedNo idea why this still shows up as RTBC when I marked it fixed above..