Page 1 of 1

Identify Command with Binary Data ?

Posted: 2009-08-28T10:45:00-07:00
by nomaam
Hello:

I am working on Debian with PHP5 and ImageMagick.

I have a web application where a user submits an image through a form and then the image is re-sized several times. I am able to use the identify command to obtain the original image details as it is written to a temporary file for processing. However, when I convert the main image to other sizes the images will be inserted directly to a MySQL database in a blob field.

I would like to obtain the converted image properties using the identify command. However, I do not want to write each of the converted images to disk solely to obtain the image properties as it would be very slow.

How can I use the identify command in the following manner?

$commandIM = "identify -format '%w %h %b %x %m' {$variable-with-image-binary-data}";
exec ($commandIM, $output);
$info = explode(' ',$output[0]);

From what I have read the identify command can only be used with a file path name... but there must be another way as writing all the files to disk just to obtain the file details and then deleting them would not be efficient by any means.

Thank you.

Re: Identify Command with Binary Data ?

Posted: 2009-08-28T10:59:05-07:00
by magick
We suspect that Imagick, the PHP ImageMagick wrapper, provides a identify call that accepts a blob (i.e. a in-memory image format). That is your most promising path forward.

Can you write the image to a shared memory segment? If so, we could add shared memory support to the ImageMagick command lines to resolve this problem.

Re: Identify Command with Binary Data ?

Posted: 2009-08-29T15:23:11-07:00
by nomaam
I do not know how to write an image to a shared memory segment. Is this function possible through other means such as the GD library or a PHP feature?