Support

August 9, 2009 by nuno costa 38 comments

Before asking for help

Please read the instructions on how to debug phMagick, this will tell you what the error is.

 

Report a Bug

You can use the issue tracker to report bugs or suggest features

 

Ask for Help

You can always mail me, I’m glad to help No email is unanswered, but as you may unserstand those who came with a little donation will take priority and a little more efort ;)

Paid Support

Paid support is also available for those who need someone with in depth knowledge of phMagick mail me your request and I will be glad to send you a quote

38 comments so far Add Your Comment

  1. by Nghia on October 7 2009 at 04:23

    Hi,

    How i create captcha from this.

    Many thanks !

    Nghia

  2. by nuno costa on October 9 2009 at 10:01

    Hi Nghia,

    You can write the text with the fromString() function then apply it as a watermark with no transparency to a any background you like

  3. by André Pletschette on November 3 2009 at 15:27

    Hello, I would like to generate images on the fly without having to save them to the disk. In fact I would like to write a PHP script returning an image to the browser (not HTML). Is this possible with phMagick?

    Greetings from Luxembourg,
    André

  4. by nuno costa on November 3 2009 at 15:30

    Helo André

    phMagick runs from the command line, so it needs to generate files, you can however easily write a php script delete them x minutes after they where created

  5. by John Whittaker on November 7 2009 at 15:17

    Hi

    Thank you very much for your great utility!

    When I used your resizeExactly function I found that it would not crop as I expected when using a source with e.g. aspect ratio 3/2 to a destination with a higher aspect ratio e.g. 4:2.

    I thought it would then cut the pic at the top and the bottom, but it did not.

    With a very small modification it works as a intend:

    ——————-
    /**
    * tries to resize an image to the exact size wile mantaining aspect ratio,
    * the image will be croped to fit the measures
    * @param $width
    * @param $height
    */
    function resizeExactly(phmagick $p , $width, $height){
    //requires Crop plugin
    //requires dimensions plugin

    $p->requirePlugin(‘crop’);
    $p->requirePlugin(‘info’);

    list($w,$h) = $p->getInfo($p->getSource());

    $desicion_height = $width * ($h/$w);

    if($desicion_heightresize($w, $h)->crop($width, $height);

    }
    ——————-

    Kind regards, John

  6. by John Whittaker on November 7 2009 at 15:21

    Here is the function again, as there were some losses because of wrong HTML-Tags:
    —————–
    /**
    * tries to resize an image to the exact size wile mantaining aspect ratio,
    * the image will be croped to fit the measures
    * @param $width
    * @param $height
    */
    function resizeExactly(phmagick $p , $width, $height){
    //requires Crop plugin
    //requires dimensions plugin
    $p->requirePlugin(‘crop’);
    $p->requirePlugin(‘info’);
    list($w,$h) = $p->getInfo($p->getSource());

    $desicion_height = $width * ($h/$w);
    if($desicion_height<$height){
    $h = $height;
    $w = 0;
    }else{
    $h = 0;
    $w = $width;
    }
    $p->resize($w, $h)->crop($width, $height);
    }

  7. by nuno costa on November 9 2009 at 15:40

    @John

    Thanks, I will test it and include it in the next release

    cheers

  8. by johny why on November 15 2009 at 07:25

    hi, sven

    i tried to run your simplest sample script (the rotation):
    rotate(45);
    ?>

    i get:
    Warning: include(phMagick.php) [function.include]: failed to open stream: No such file or directory in /home/alexan48/public_html/phmagick/testphmagick.php on line 2

    my webhost tells me ImageMagick is installed. It’s path is:
    ImageMagicK :- /usr/local/ImageMagick/bin

    can you help?
    many thanks
    johny

  9. by nuno costa on November 16 2009 at 00:22

    @johny

    The errors says it can not find a file named phMagick.php, your server file system is case sensitive so type the file name the same way it’s on your file system (ex: phmagick.php)

  10. by johny why on November 16 2009 at 01:26

    hi nuno

    ok, now i’m not getting the error, just a blank page. is there a problem going from jpg to png?

    rotate(45);
    ?>
    

  11. by johny why on November 16 2009 at 01:34

    note, the script comes from your ReadMe. thanks!

  12. by johny why on November 16 2009 at 01:36

    oh, i see, the result pngs are just saved into the directory! nice. now i have to figure out how to return them to the webpage.

  13. by johny why on November 16 2009 at 02:06

    i’m getting pdf conversions, great! problem, any pdf larger than about 200 Kb comes out scrambled. any idea why that might be? thanks! (feel free to delete my obsolete comments in this thread)

  14. by johny why on November 16 2009 at 06:46

    hi, i’ve read that your tool can be used to access the entire ImageMagick function library, through some sort of “exec” function. I cannot find instructions for this in your documentation. Can you help?

    thanks much!

  15. by nuno costa on November 17 2009 at 04:00

    Well, you can not access all of ImageMagick right now

    The exec function is a php function that executes systems calls, that’s what phMagick does, it builds a command line and then call the exec function to run the command

    If you know the commands you can mail them to me and I will add them to phMagick

  16. by Stephen Hartigan on November 23 2009 at 18:53

    Hi, I’m trying to create a multi-page TIFF from a bunch of single page TIFF files
    This works at the command line> convert p1.TIF p2.TIF p3.TIF multi3.TIF
    Can this be scripted in PHP? Thanks!

  17. by nuno costa on November 24 2009 at 12:19

    I think you can, try

    $phmagick->setSource(“p1.TIF p2.TIF p3.TIF”)

    that should do the trick

  18. by grek on November 25 2009 at 14:07

    hy the crop option is not ready ? is not active in documentation

  19. by nuno costa on November 25 2009 at 19:52

    Hi grek,

    The crop function exists but it’s not documented

    it would be great, if you want to contribute and document this function

    cheers

  20. by Subal Smith on December 15 2009 at 01:16

    Hi Sven,
    I have used phMagick in the past with no problem. Today I am trying to get it working on a server which had to install ImageMagick. I cant seem to get it working though – I used your debug code and got the following:

    phMagick: Error executing “convert -scale “200x>” -quality 80 -strip “source.jpg” “resized.jpg””
    return code: 127
    command output :”sh: line 1: convert: command not found”
    Notice: exception ‘phMagickException’ in /home/noisepop/public_html/2010/dev/phmagick/phmagick.php:189 Stack trace: #0 /home/noisepop/public_html/2010/dev/phmagick/plugins/resize.php(46): phmagick->execute(’convert -scale …’) #1 /home/noisepop/public_html/2010/dev/phmagick/phmagick.php(205): phMagick_resize->resize(Object(phmagick), 200, 0) #2 [internal function]: phmagick->__call(Array, Array) #3 /home/noisepop/public_html/2010/dev/phmagick/index.php(6): phmagick->resize(’resize’, Array) #4 {main} in /home/noisepop/public_html/2010/dev/phmagick/phmagick.php on line 189

    Array
    (
    [0] => Array
    (
    [cmd] => convert -scale “200x>” -quality 80 -strip “source.jpg” “resized.jpg”
    [return] => 127
    [output] => Array
    (
    [0] => sh: line 1: convert: command not found
    )

    )

    )
    1

    Please advise – thank you very much.

    PS – love to buy you a beer ;]

  21. by nuno costa on December 15 2009 at 16:47

    @Subal Smith

    It seems that imagemagick is not in your system path (you must restart apache after installing imagemagick)

    see this article for alternative ways to tell phMagick where imagemagick is : http://www.francodacosta.com/blog/phmagick/examples/error-convert-invalid-parameter

    For the beer, you can go here : http://www.francodacosta.com/blog/about/buy-me-a-beer ;)

  22. by Bogdan Kharchenko on December 25 2009 at 07:25

    How can I do multiple image re-sizes from same source file? I’ve tried this, but I get two same image outputs.

    $x = new phmagick(“image.jpg”);
    $x->setDestination(“outputlarge.jpg”)->resize(1600,1600);
    $x->setDestination(“outputsmall.jpg”)->resize(640);

  23. by Jan-Berend on December 29 2009 at 15:16

    Hi, when i’m generating one image all works fine but when try to fill my gallery my Xampp crashes, without an error.
    The images are generated thru the url like:
    http://localhost/thumb/id/10.jpg

    It seems like imagemagick or phmagick can’t have multiple instances at the same time. Any solution?

    Tnx!

  24. by Kith on December 30 2009 at 19:11

    Just saw that you released a new version with the “resizeExactly” command. Works fine, but it seems, that no .PNG images are supported?! :-/

  25. by Christopher Tsanos on January 13 2010 at 01:00

    I just came across this and it seems great.

    I am having some issues with it. I used debug you suggested and still get this. I restarted my apache and have tried various paths as described in the link above. Any help would be greatly appreciated.

    Thanks

    phMagick: Error executing “convert -scale “200x>” -quality 80 -strip “source.jpg” “resized.jpg”"
    return code: 127
    command output :”sh: convert: command not found”
    Array
    (
    [0] => Array
    (
    [cmd] => convert -scale “200x>” -quality 80 -strip “source.jpg” “resized.jpg”
    [return] => 127
    [output] => Array
    (
    [0] => sh: convert: command not found
    )

    )

    )
    1

  26. by Ting on January 20 2010 at 13:42

    Hi,

    I’m using phMagick to resize image, but i got some errors “rc: 7″ and “rc: 1″, what does errors mean? plz help me.

    Thank so much.

  27. by nuno costa on January 20 2010 at 21:19

    @Christopher Tsanos

    You need to have imagemagick installed and in your path

    check http://www.francodacosta.com/blog/phmagick/examples/error-convert-invalid-parameter for information on how to manually specify the path to imagemagick

  28. by nuno costa on January 20 2010 at 21:20

    @Kith

    probably imagemagick can’t find libpng

  29. by nuno costa on January 20 2010 at 21:22

    @Jan-Berend

    you should use the phisical path for the images

    have you checked your webserver logs (apache and php error logs) I’m sure you will find fullish information in there

  30. by nuno costa on January 20 2010 at 21:25

    @Bogdan Kharchenko

    $x = new phmagick(”image.jpg”);
    $x->setDestination(”outputlarge.jpg”)->resize(1600,1600);
    $x->setSource(‘image.jpg’)
    $x->setDestination(”outputsmall.jpg”)->resize(640);

  31. by nuno costa on January 20 2010 at 21:36

    @Ting

    please check http://www.francodacosta.com/blog/phmagick/examples/debugging-phmagick and download the latest version of phMagick the rc : 7 style of errors are from a very old version

  32. by Thomas Gatt on February 8 2010 at 20:30

    Dear Sven,

    I am running your script on a windows environment and I’m having the following issue when resizing an image:

    An error occured:
    phMagick: Error executing “convert -scale “600x>” -quality 80 -strip “../backend/images/albums/Tesr/07feb10_PVD_ARENA_MEL_5133.jpg” “../backend/images/albums/Tesr/07feb10_PVD_ARENA_MEL_5133.jpg”"
    return code: 1
    command output :”Access is denied.”
    Notice: exception ‘phMagickException’ in C:\Inetpub\vhosts\freshevents.info\httpdocs\freshnewsite\backend\phmagick.php:189 Stack trace: #0 C:\Inetpub\vhosts\freshevents.info\httpdocs\freshnewsite\backend\plugins\resize.php(46): phmagick->execute(‘convert -scale …’) #1 [internal function]: phMagick_resize->resize(Object(phmagick), 600, 0) #2 C:\Inetpub\vhosts\freshevents.info\httpdocs\freshnewsite\backend\phmagick.php(205): call_user_func_array(Array, Array) #3 [internal function]: phmagick->__call(‘resize’, Array) #4 C:\Inetpub\vhosts\freshevents.info\httpdocs\freshnewsite\backend\uploadimages.php(76): phmagick->resize(600, 0) #5 {main} in C:\Inetpub\vhosts\freshevents.info\httpdocs\freshnewsite\backend\phmagick.php on line 189
    Array
    (
    [0] => Array
    (
    [cmd] => convert -scale “600x>” -quality 80 -strip “../backend/images/albums/Tesr/07feb10_PVD_ARENA_MEL_5133.jpg” “../backend/images/albums/Tesr/07feb10_PVD_ARENA_MEL_5133.jpg”
    [return] => 1
    [output] => Array
    (
    [0] => Access is denied.
    )

    )

    )
    1
    {“status”:”1″,”name”:”07feb10_PVD_ARENA_MEL_5133.jpg”}

    any help please?

  33. by nuno costa on February 8 2010 at 22:19

    @Thomas Gatt

    This seems like a permissions issue, does the web user user has access to to convert.exeor the files ?

    Any useful information on the server logs?

  34. by Max Vatel on July 28 2010 at 07:08

    Hello,

    Is it possible to capture an html page with image magick and to generate a thumbnail on the fly ?
    How would you to this ?

    Best regards

  35. by Elay on December 3 2010 at 00:09

    Hello. After convert image from CR2 to JPG i saw darken image. What can be the reason for it ?

  36. by maxsoad on December 20 2010 at 19:38

    Hi, it is the best library of all that I used.
    But I find bug into resizeExactly function, it returns empty.
    please, change string:
    $p->resize($w, $h)->crop($width, $height);
    on:
    return $p->resize($w, $h)->crop($width, $height);

  37. by Will on November 26 2011 at 15:53

    Can you give any indication how fast phMagick is compared to using imagick? i.e. for thumbnailing and resizing for example

  38. by nuno costa on December 2 2011 at 10:00

    It should be a bit slower than imagick but much easier to use.
    Imagick is a native php extension and phMagick does a system call

    if you do a benchmark I would be very interested in the results

More from francodacosta.com

© francodacosta.com - All rights reserved