SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ImageMagick in windows?

    I try the following simple code and somehow it just doesnt work.
    Any ideas greatly appreciated

    PHP Code:
    <?php

    $file   
    'C:\Program Files\Apache Group\Apache2\htdocs\hard_disk.jpg';
    $saveAs 'C:\Program Files\Apache Group\Apache2\htdocs\newhard_disk.jpg';

    IMResize$file$saveAs1010 );

    function 
    IMResize$file$saveAs$width$height )
    {
       
    $source file_get_contents$file );
       
    $handle fopen$saveAs'w' );
       
    fwrite$handle$source );

       
    $cmd "C:\Program Files\ImageMagick\mogrify -resize $width x $height " $saveAs;
       
    exec$cmd );
    }

    ?>

  2. #2
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,357
    Mentioned
    80 Post(s)
    Tagged
    3 Thread(s)
    A working example of creating a thumbnail on my site at http://www.rubblewebs.com/imagemagick/thumbnail.php

    morgrfy is used if you want to do a whole folder of images and save them with the same name.

    You should be able to see how my code works and modify yours to suite.

    I also notice you do not have the original image to modify in this line:
    PHP Code:
    $cmd "C:\Program Files\ImageMagick\mogrify -resize $width x $height " $saveAs


    $cmd "C:\Program Files\ImageMagick\mogrify -resize $width x $height $source $saveAs"
    In fact I can not see why you are using file_get_contents, fopen, fwrite etc. I would start again !

    Although I am not 100% I am only trying out different things with ImageMagick when I get time


    Anthony


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •