Closed (outdated)
Project:
ImageMagick
Version:
7.x-1.0-alpha2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Sep 2011 at 08:00 UTC
Updated:
20 Jan 2025 at 14:55 UTC
Jump to comment: Most recent
Comments
Comment #1
gdl commentedHi!
As I understand it, there's a convention within Drupal that functions that begin with an underscore should be considered "private" (to crib an object-oriented programming term), and generally should not be called directly from outside the module that contains the function that starts with an underscore.
That said, I don't think that calling _imagemagick_convert() directly is the right way to do what you're describing. Instead, you might want to look at the most recent development version of ImageMagick, which incorporates some changes to allow format conversion. There's an implementation of an Image Style that does format conversion at #1235966: Implement image_imagemagick_convert_image that should be adaptable to a custom Image Style that does what you want.
Your question about whether drupal_realpath() should be called on the file or on the directory that will contain the destination file is a good one, though.
Cheers,
-G
Comment #2
dippers commented@gdl: Thanks for the reply. I would be happy to use a public function if one existed. The imagecache_coloractions changes for imagemagick only work on jpg, gif or png files not pdfs. I cannot find any reference to format conversion in the latest dev.
Pdfs to jpgs used to be easy in D6 as you could upload a pdf file to an image file field but the stricter tests on D7 core image means this is no longer possible. You now have to upload the pdf as a file and implement a custom field formatter that calls the image style.
For now I will use a patched version of _imagemagick_convert that works perfectly.
Comment #3
sunThe actual problem of this issue isn't clear to me.
Submitting your changes to _imagemagick_convert() as a patch might help to clarify this issue.
Comment #4
mondrakeDrupal 7 is EOL