Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I was getting the following error on pages with inline images inserted usning insert module:
Warning: getimagesize(/sites/default/files/styles/medium/public/images/inline/page/image-1.jpg) [function.getimagesize]: failed to open stream: No such file or directory in _caption_filter_get_width() (line 103 of .../sites/all/modules/contrib/caption_filter/caption_filter.module).
Adding the following check for array_key_exists prevented the error from appearing.
if (!empty($src_result) && array_key_exists('1', $src_result)) {
list($width) = getimagesize($src_result[1]);
}
Comment | File | Size | Author |
---|---|---|---|
#19 | caption_filter-refactor_image_url_discovery-1402056-19.patch | 2.05 KB | krisahil |
#13 | caption_filter_decode_1.patch | 632 bytes | druplr |
#13 | caption_filter_decode_2.patch | 977 bytes | druplr |
#4 | add_check_for_local_images-1402056-4.patch | 1.58 KB | jenlampton |
#5 | add_check_for_local_images-1402056-5.patch | 1.4 KB | jenlampton |
Comments
Comment #1
jenlamptonpatchy patchy.
Comment #2
lpelty CreditAttribution: lpelty commentedThanks for the patch but I'm getting a file not found page. Can you reupload?
Thanks.
Comment #3
jenlamptonHm. silly d.o! trying again.
Comment #4
jenlamptonLooks like that didn't solve the issue on sites where I'm using relative paths. The problem here is that caption_filter assumes we'll be providing a fully qualified URL to the image in the src tag, and when you check the use-local-paths checkbox on the insert module (which everyone should do) caption_filter module is unable to correctly locate the file from the relative path.
Here's a more comprehensive patch that checks if the image src is local or remote and acts accordingly.
Comment #5
jenlamptonLooks like that last patch added an extra } for some reason. Trying again.
Comment #6
wwalc CreditAttribution: wwalc commentedNot sure if it makes sense to make the patch co complex. I'd go with something like:
Comment #7
jenlamptonI don't think that solves the local vs remote problem, as noted above. Does it?
Comment #8
wwalc CreditAttribution: wwalc commented@jenlampton - True, I was simply using URLs to images located on an external server and wanted to get rid of the error somehow. I missed the point that your patch tries to handle absolute URLs (starting with
http://
) that point to local files, so it looks like a more comprehensive approach. I did not test it though.Comment #9
siefca CreditAttribution: siefca commentedSee also http://drupal.org/node/1873900
Comment #10
arh1 CreditAttribution: arh1 commentedIn quick testing, #5 above works for me. Thanks, @jenlampton
Comment #11
kmontyThanks for the patch! Confirmed this was the source of the issue. Tweaked the patch a little bit + committed.
http://drupalcode.org/project/caption_filter.git/commitdiff/aadce429b8a9...
Comment #13
druplr CreditAttribution: druplr commentedThanks for the patch. I downloaded 7.x-1.x-dev (2013-Apr-10), which fixed the issue for some of my files, but I still had problem with files having space in the filename, which encodes to %20. To avoide this issue, used rawurldecode() function. Please see the attached patches.
Comment #14
kmontyPlease open new tickets for new issues. Thanks!
Comment #14.0
kmontyremove weirdness
Comment #15
aitala CreditAttribution: aitala commentedPatch #5 did not work for me in all cases. Am still seeing the error for anonymous users
Warning: getimagesize(sites/default/files/styles/medium/public/img_6622.jpg?itok=Y2JO0smR): failed to open stream: No such file or directory in _caption_filter_get_width() (line 121 of .../sites/all/modules/contrib/caption_filter/caption_filter.module).
Eric
Comment #16
tchopshop CreditAttribution: tchopshop commentedHaving this issue still after patching both on local and live sites. These errors are really out of control.
Update: the errors were still happening after the patch because another module was hanging cron. But fixed now.
Comment #17
Jason2014 CreditAttribution: Jason2014 commentedWarning: getimagesize(/home/admin/web/xxxxx.com/public_html/sites/default/files/logo.png): failed to open stream: No such file or directory in _caption_filter_get_width() (line 148 of /home/admin/web/xxxxx.com/public_html/sites/all/modules/caption_filter/caption_filter.module).
http://picpaste.com/pics/weird-Jdzfi5oP.1394646711.png
Images are not staying in the frame. Sometimes though go out side and sometimes they are too small. The above is the error I get. Im using the Dev Version.
7.x-1.x-dev zip (20.44 KB) 2014-Mar-04
[EDIT]
Patch 5 does indeed work for me. I was patching the wrong file. Using the original and not the dev worked!
Comment #18
thomas1977 CreditAttribution: thomas1977 commentedAny plans to release a new (dev) version with the #5 included (for all us non-patchers...). Thanks.
Comment #19
krisahil CreditAttribution: krisahil commentedRe-factored the patch (I know it's already applied to 7.x-1.x branch) to account for missing local and remote images. It should apply cleanly to 7.x-1.2 release.
Comment #20
deanflory CreditAttribution: deanflory commentedPatch #19 fails against 7.x-1.x (I know you said it was already applied, but not with your fixes right?):
Any chance of getting the patch rerolled against 7.x-1.x -dev or is it necessary?
Comment #21
kmontyReopening since people are still having this issue.
Possibly related: #2059165: Trouble Getting Width of the Image
Comment #22
aitala CreditAttribution: aitala commentedAny idea if this issue is affecting the 1.3 version?
Eric
Comment #23
wylbur CreditAttribution: wylbur as a volunteer commentedWe're using Panopoly and still seeing these errors on our site currently with the 1.3 module version.
Warning: getimagesize(): php_network_getaddresses: getaddrinfo failed: Name or service not known in _caption_filter_get_width() (line 151 of /public_html/profiles/panopoly/modules/contrib/caption_filter/caption_filter.module).
We're using PHP 7.2
I'll try to roll a patch and test on the latest DEV.
Comment #24
wylbur CreditAttribution: wylbur as a volunteer commented