Page 1 of 1
Identify fails for remote URL
Posted: 2016-08-30T12:34:48-07:00
by alex@shopnation.com
Identify fails for remote URL. curl, wget, chrome, etc.. get the image OK.
image url:
Code: Select all
http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink
Code: Select all
e7450-gd5tf72:Downloads alex$ identify -version
Version: ImageMagick 6.9.4-9 Q16 x86_64 2016-06-13 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
e7450-gd5tf72:Downloads alex$ identify "http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink"
error : Unknown IO error
identify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
identify: no data returned `http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink' @ error/url.c/ReadURLImage/247.
Thanks,
Alex
Re: Identify fails for remote URL
Posted: 2016-08-30T15:34:33-07:00
by fmw42
Re: Identify fails for remote URL
Posted: 2016-08-30T15:51:36-07:00
by snibgo
It works fine for me, IM v6.9.5-3 on Windows 8.1, at the Windows command prompt:
Code: Select all
f:\web\im>%IM%identify "http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink"
http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink=>sizer]&sink JPEG 178x234 178x234+0+0 8-bit sRGB 9.54KB 0.000u 0:00.000
The same command also works from the Cygwin bash shell.
(Personally, I wouldn't use "http:" in IM commands because comms is the slowest and least reliable part of the process, and IM isn't engineered to diagnose or recover from comms problems.)
Re: Identify fails for remote URL
Posted: 2016-08-30T16:35:11-07:00
by alex@shopnation.com
Note sure what this has to do with the security issue.
I guessed that its something with the URL characters and got this command to work (note brackets are URL encoded):
Code: Select all
e7450-gd5tf72:keys alex$ identify 'http://images.destinationmaternity.com/dmc?set=ImageURL%5B2651696cu.jpg%5D,Imagesize%5Bthumb%5D&call=url%5Bfile:sizer%5D&sink'
http://images.destinationmaternity.com/dmc?set=ImageURL%5B2651696cu.jpg%5D,Imagesize%5Bthumb%5D&call=url%5Bfile:sizer%5D&sink=>sizer%5D&sink JPEG 178x234 178x234+0+0 8-bit sRGB 9.54KB 0.000u 0:00.000
Why would the brackets prevent the command from working?
FYI I am on OSX 10.11.6
Re: Identify fails for remote URL
Posted: 2016-08-30T16:54:55-07:00
by snibgo
I assume that IM passes %5B etc straight through to the comms s/w, without interpretation.
Square brackets [] have a special meaning within IM, eg x.tif[3], so IM processes them specially. The code for this may have changed between your version (6.9.4-9) and mine (6.9.5-3).
Re: Identify fails for remote URL
Posted: 2016-08-31T12:11:32-07:00
by alex@shopnation.com
curl also has issues with this url:
Code: Select all
alexs-MacBook-Pro:~ alex$ curl 'http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink' > test.jpg
curl: (3) [globbing] bad range in column 57
unless I add the -g option to disable globbing
Code: Select all
alexs-MacBook-Pro:~ alex$ curl -g 'http://images.destinationmaternity.com/dmc?set=ImageURL[2651696cu.jpg],Imagesize[thumb]&call=url[file:sizer]&sink' > test.jpg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9537 100 9537 0 0 45990 0 --:--:-- --:--:-- --:--:-- 45850
wget seems to work OK.
Re: Identify fails for remote URL
Posted: 2016-09-01T18:41:47-07:00
by alex@shopnation.com
Is there any way to disable interpretation/globbing the file name/url with IM?
We are using the im4java library which calls IM on the command line and would prefer IM to download the files instead of rolling our own file management code and/or calling curl manually.
Also I just found out the IM is on github now. Is that a better place to post this issue?
Re: Identify fails for remote URL
Posted: 2016-09-08T19:50:31-07:00
by alex@shopnation.com
I poked around the code here:
https://github.com/ImageMagick/libxml/blob/master/uri.c
and decided to workaround this issue by manually URL encoding the following characters before passing the URL to IM: