logo       

Re: MagickWand: msg#00029

video.image-magick.bugs

Subject: Re: MagickWand

--- yarrow@xxxxxxxxxxxxxxxxxxxxxx wrote:

> I added
>
> quantum=GetMagickQuantumDepth(&depth);
> if (depth != QuantumDepth)
> ThrowMagickFatalException(WandError,"WandQuantumDepthMismatch",quantum);
>
> to the MagickWand api so a the program will produce an error if the
> MagickWand Quantum depth does not match that of the core API.
>

Hmmm... I don't think I explained my issue properly...

Series of events:

1) Successfully converted 15 page TIFF fax to 15 page PDF, using MagickWand for
PHP

2) Noticed fairly slow performance, and wondered if Quantum depth had anything
to do with it

3) RE-COMPILED EVERYTHING (ImageMagick + PHP) with ImageMagick having a Quantum
depth of 8
(several of MFP's internals are based on MaxRGB, so a different Quantum depth
has quite an effect
on some hard-coded static variables / script-visible constants, so recompiling
was necessary)

4) Tried the EXACT same script I used when the Quantum depth was 16, with
Quantum depth = 8, and
PHP caused an internal server error.

5) Tried several things, and eventually inserted some debugging code in MFP, so
that whenever an
image was written, something approximate to

"Preparing to write \"INSERT_IMAGE_FILENAME_HERE\""

would be printed in PHP's logs before control was passed on to
MagickWriteImages() and
MagickWriteImageFile() from my code, and something to the effect of

"\"INSERT_IMAGE_FILENAME_HERE\" written successfully"

would be printed in PHP's logs, if those methods returned MagickTrue, with

"FAILED: could not write "INSERT_IMAGE_FILENAME_HERE"

printed if they returned MagickFalse.

6) Re-compiled everything, and tried the script again (which again, works in
it's C version, and
under Quantum depth 16 in PHP).

The result: all messages up to MagickWriteImages() or MagickWriteImageFile(),
(the last messages
are printed from the line directly before the calls to these functions), print
in the PHP log, and
then PHP crashes (due to something in MagickWriteImages() or
MagickWriteImageFile()), for some
reason.

My question should have been, what is the difference, if any, between the way
images are written
with the Quantum depth == 16 and with the Quantum depth == 8?


NOTE: If you are wondering about MagickWriteImage(), it is implemented in PHP,
but the C API
function that is actually called is MagickWriteImageFile(), with the FILE* sent
to the function
being a php_stream* cast to FILE*. I did this in order to enable the filesystem
security checks
that PHP does on files it opens, as there is no easy way to do them otherwise
(actually, there is
no hard way that I have found either, and I didn't have that much time to
look). As for
MagickWriteImages(), it is used when a user requests that the images be joined
into one file, as I
had not way of doing that otherwise. (However, a nasty kludge, of actually
opening the file for
appending in PHP, and, if successful, closing it, and then passing control off
to
MagickWriteImages(). Now that MagickGetImagesBlob() has been implemented, this
will change, but it
is this way now.

This, by the way, is how I know that the problem is not in PHP itself, but
rather in some
PHP-ImageMagick interaction, as BOTH MagickWriteImageFile(), and
MagickWriteImages() crash PHP.




__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise