Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Image uploads are not showing - I tested creating a new content type and added an image field.
Image field was set to use the thumbnail style and large style when viewing in teaser and full page mode.
I checked the files directory and the files were there - however when you go to the styles directory and look into the thumbnail and large directories, there are no images.
I tested loading the images on a separate page and I got the "Error generating image." message
Comment | File | Size | Author |
---|---|---|---|
#12 | jpg-image-uploads-788102.patch | 790 bytes | AaronBauman |
Comments
Comment #1
h3000 CreditAttribution: h3000 commentedAlso, I might add that on a drupal 6 site on the same server, images uploads are working fine.
The Drupal 7 status reports don't show any problems with the file permissions settings for the directories.
Are there any other properties or configurations to set to allow image file uploads or to make the images appear in Drupal 7?
Comment #2
eojthebraveDoes your watchdog table have any relevant error messages? Same goes for php/apache logs.
Comment #3
h3000 CreditAttribution: h3000 commentedJust error messages whenever it tries to load the images:
image load failed directory: public://styles/gallery_thumbnail, public://IMG_3150.jpg
Unable to generate the derived image located at public://styles/gallery_thumbnail/IMG_3150.jpg.
gallery_thumbnail is a new image preset I created. But using the default thumbnail and large presets did not work as well.
Comment #4
hyperart CreditAttribution: hyperart commentedIt appears that it flakes out when you add an image in a node that does not require resizing at posting.
Like, if my "medium" resolution is set to 400x400px, and I upload a 350x350px image, the
<img>
tag will not issue the right path, even though the image IS uploaded. However, there is no copy of the image in the "medium" folder.If the uploads are larger than the resolution limits, then all seem to work fine.
At least that's how it seems for me!
Comment #5
h3000 CreditAttribution: h3000 commentedYes - this seems to be the case - I have been uploading image sizes within my maximum image size setting.
I now tested uploading images over the maximum image size and as mentioned by hyperart, the images appeared. Probably the process to resize the image to the preset styles was not called when the correct sized image is uploaded?
My other issue is that my image field is a multi-value image field - however, whenever I want to add a new image, I need to press the upload button and then wait for it to finish uploading before I can add a new image! This seems to be counter intuitive. Of course this is still an alpha version but I hope this will be fixed by the beta version.
Comment #6
acouch CreditAttribution: acouch commentedI just experienced this problem as well with the latest dev version described in #3.
I've found that the same images will have different behavior if they have been opened with an image editor (gimp and f-spot) and resaved. The exif data from the saved images is identical except for " Unknown tag, Tagnum 0x4746 = data ===> 0" in the one that doesn't work.
I'm using PHP 5.2.6-3ubuntu4.5 with Suhosin-Patch 0.9.6.2 on ubuntu 9.04.
Comment #7
eojthebrave@aaroncouch, any chance you could provide a copy of the "corrupted" image file? So I can test this out. Thanks.
Comment #8
acouch CreditAttribution: acouch commentedhere is an example "corrupted" image: http://aaroncouch.info/sites/default/files/149_0184.JPG
Comment #9
MrRoxy CreditAttribution: MrRoxy commentedsame problem! 1 of 3 images works.
(also image cache not works...)
Comment #10
AaronBaumanI am only experiencing this issue with .jpg's, which others have experienced as well.
@see #821962: JPG images won't upload - GIF and PNG work fine.
Is anyone on this thread able to duplicate the issue with .gif or .png?
I confirmed the experience in #4 that this is only relevant when the image is within the limits.
Bumping to critical, since by default there is no resolution limit, hence by default .jpg uploads are broken for image field.
Comment #11
AaronBaumanupdating title to more precisely reflect the issue
Comment #12
AaronBaumanThe attached patch fixes the issue for me, but I have no idea why:
For some reason, throwing the second optional parameter to getimagesize causes the return value to be properly populated.
I can't find a reasonable explanation after cursory searching and I don't care to offer my own conjecture.
Is this just a quirk on my PHP install?
Can anyone confirm?
Comment #13
chx CreditAttribution: chx commentedI downloaded http://aaroncouch.info/sites/default/files/149_0184.JPG and ran php -r 'var_dump(getimagesize("149_0184.JPG"));' and got the expected results. I tried PHP 5.2.13 and PHP 5.3.2
can you tell me what's the problem, here?
Comment #14
AaronBaumanComment #15
AaronBaumanI am running php 5.2.9, and I get the same behavior chx described on the command line, but not in Drupal.
To reproduce in Drupal:
- install minimal from latest dev
- enable image + fields ui
- create a node type and add an image field to it
- create a node of that type and upload the referenced image
here is my debugging code:
The result of the debugging code, when following the steps to reproduce above (load the page at least twice to see it).
Note that $data is empty:
Also worth noting, the filename passed to getimagesize() is prefixed with the schema (defaults to "public://"), which maybe changes things a bit.
Comment #16
asimmonds CreditAttribution: asimmonds commentedI didn't see this issue when I opened #844676: (Tests needed) Stream wrappers stream_seek() return is invalid which I think could be related, fseek() used on a Drupal stream doesn't work properly. You can see this when getimagesize() tries to process a .jpg with EXIF metadata.
Comment #17
chx CreditAttribution: chx commentedExcellent analysis closing this one down in favor of the other, already patched issue.
Comment #18
netpumber CreditAttribution: netpumber commentedGuyz im trying to run the patch at #12 but doesn't seems to work
it returns me this :
That wahts i run
patch image.gd.inc < jpg-image-uploads-788102.patch
Any idea on how to fix this issue?
Comment #19
chriscalip CreditAttribution: chriscalip commentedError Spotted @ Drupal 7.12
Drupal 7.12 already contains patch http://drupal.org/files/issues/php_is_a_sorry_mess.patch provided by issue
#844676: (Tests needed) Stream wrappers stream_seek() return is invalid @link http://drupal.org/node/844676
Because 7.12 has the patch recommended by the said issue and error still occurs; I am changing to active. Please update as needed.
** Edit **
I would also like to state that comment # 12 patch http://drupal.org/files/issues/jpg-image-uploads-788102.patch fixed the error sighting on my install.
Comment #20
tim.plunkettThis issue has been marked as a duplicate of #844676: (Tests needed) Stream wrappers stream_seek() return is invalid. If there is still a problem, please follow up over there.
Comment #21
JvE CreditAttribution: JvE commentedComment #22
Hemu45043 CreditAttribution: Hemu45043 commentedFailed to load thumbnail msg received in my mobile oppo F1S
Please solve my problem