Page 1 of 1
Convert url of php script into an image
Posted: 2012-02-01T08:05:27-07:00
by marktorregrossa
Is there a way to take a url that is php and turn that output on the webpage to an image? I'm doing this same thing using convert then the url. But that url pulls up a gif image that I can alter. I'm assuming the problem is that the webpage from the php url isn't an image. here's the url:
http://forecast.weather.gov/wtf/meteogr ... 6&psnwhr=6
The display on the webpage is actually a .png image, and I can even end the url with .png like this:
http://forecast.weather.gov/wtf/meteogr ... nwhr=6.png
Thanks for any guidance.
Re: Convert url of php script into an image
Posted: 2012-02-01T17:02:37-07:00
by anthony
IM should see the "http:" prefix which will override the ".php" suffix.
That means it will read and try to convert the HTTP: url directly, that is download and convert the content of the page.
If the page returned is html, then it will likely use the tool "html2ps" to do the conversion (if installed) then use "ghostscript" to convert the resulting postscript to an image. Turning on verbose should let you see what happens (I think).
If the contect is PNG however it will see the 'magick' of the PNG file and convert that. You should have no problems.
Note you will need to quote the filename, unless you have IM read the filename from a list of files. EG: "@image_list.txt"
Re: Convert url of php script into an image
Posted: 2012-02-01T21:55:53-07:00
by marktorregrossa
thanks much sir! I was just missing quoting the image. Sure helps to have a second set of eyes.
Re: Convert url of php script into an image
Posted: 2012-02-07T19:00:29-07:00
by marktorregrossa
Anthony,
Now I can't get this url to work. It should be the same as the link above, but maybe it's not a url type image magick likes?
Code: Select all
#!/bin/bash
/usr/bin/convert "http://water.weather.gov/precip/index.php?yday=1328616000&yday_analysis=0&layer[]=0&layer[]=1&layer[]=4&timetype=RECENT&loctype=STATE&units=engl&timeframe=current&product=observed&loc=conus.gif" -crop 627x409+450+350 +repage farmerweather/images/observedprecip/precip_last_24hrs.gif
Can you let me know if you think this type of url wont work.
thanks
Re: Convert url of php script into an image
Posted: 2012-02-07T20:50:19-07:00
by fmw42
I believe the boxes mean that there is some character that is not recognized. Check your link an see what was there. You may need to find the correct html escaped characters. Or you have brackets that may not be properly resolved or missing some character or numeral inside them.