Reply to Getting and using binary image data from ImageMagick

Your name:

Reply:


Posted by Chuck Anderson on 07/19/07 05:30

I am trying to use ImageMagick to create thumbnails on the fly - without
having to save the image to a file.

I have gotten it to work by using passthru($cmd, $retval), but I want to
use something else that will give me the complete output returned as a
string that I can convert to a GD lib image resource so I can verify the
operation worked before sending the Content-type header for the image.

This works:
---------------------------------------------------------
// $photo = path to image file
$cmd = "convert.exe -size 250x250 \"$photo\"" .
' -resize 125x125' .
' -strip' .
' -unsharp 0.2x0.6+1.0' .
' -quality 87 JPG:-';

header("Content-type: image/jpeg");
passthru($cmd, $retval);
---------------------------------------------------------

Using this, the resized image is displayed in my browser.

However, I would rather get the binary output from ImageMagick into a
variable and then test retval (or use some other method) to determine if
the operation was successful.

I've tried shell_exec ...
$output = shell_exec($cmd);
.... but the data in $output appears truncated (ÿØÿà�JFIF�,,��ÿÛ�C�
- is all there is). ??

Has anyone done anything like this? Any suggestions?

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация