MagickSetImageFormat()

Discussion in 'PHP' started by Methok, Jul 21, 2009.

  1. #1
    Hello,

    I am currently trying to change the format of an uploaded image. I have currently got it to resize perfectly fine but using the following code I just cant seem to get it to work.

    For example if I uplaod a jpeg and want to change it to a gif.


    MagickSetImageFormat($resource, 'GIF' );
    MagickWriteImage( $resource, $path );
    PHP:
    But as I say its not working.

    Any help would be great.

    Thank you :)

    - Methok
     
    Methok, Jul 21, 2009 IP
  2. mushu

    mushu Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i was having the same exact problem, and i think i succeeded by doing it this way:

    exec("convert image.jpg image.png");­

    not quiet sure cause it was long time ago but try it and let me know what happened
     
    mushu, Jul 21, 2009 IP
  3. Methok

    Methok Peon

    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK, Seems its creating an file where its meant to. Its changing the extension as its meant to. Only the file size for the new file is 0. So, im going to run head first into a wall, haha.

    Been at it too long now.
     
    Methok, Jul 21, 2009 IP
  4. Methok

    Methok Peon

    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Problem solved.

    Thank you mushu. It was your method that helped. Just needed have time away from it and have a coffee to see my mistake. Thank you.
     
    Methok, Jul 21, 2009 IP
  5. mushu

    mushu Peon

    Messages:
    147
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i knew it that it should have worked. I was not able to try it at home yesterday cause i dont have php at home so i was just guessing on the solution. Now when i came to work i was playing with it and realized that it worked for me and now i just loged in to tell you that its solved and saw that you made it too. good luck than i am happy that i helped
     
    mushu, Jul 22, 2009 IP