[imagemagick] Convert Jpeg, Gif to Png


Libraries and PHP frameworks

Topic:

PHP Libraries and Frameworks

  1. WeDgEMasTeR wrote: 18/04/2006 at 17:42

Default [ImageMagick] Convert jpeg, gif to png


  1. Good morning
  2. I found this piece of code in the php sources:
  3. 1

    2

    3

    4

    5

    6

    7

    8

    9

  4. johweb wrote: 18/04/2006 at 17h50

Default


  1. Did you test before asking… ? ^^
  2. WeDgEMasTeR wrote: 18/04/2006 at 18:07

Default

  1. :roll:
    no…

  2. I confess that I am lazy to create a test page :p
  3. Well, I’ll try to do that, then.
  4. johweb wrote: 18/04/2006 at 18:14pm

Default

  1. Quote
    Sent by WeDgEMasTeR

  2. Well, I’ll try to do that, then.
  3. I think it’s a good idea ^^
  4. WeDgEMasTeR wrote: 18/04/2006 at 18:45

Default


  1. I can’t test…
  2. I wrote this down:
  3. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181920212223242526272829303132333435363738394041424344
  4. Yogui wrote: 18/04/2006 at 22:45 hours

Default


  1. Hi
  2. Your function seems to perform a silly filename change, not a recording per se. This is a tricky technique because you will have a file with a .png extension but the MIME type of the file will still be JPEG, in reality.
  3. I recommend you use the GD library. This is done in a maximum of 6 lines of code.
  4. WeDgEMasTeR wrote: 18/04/2006 at 23h27

Default


  1. Yes, I have the impression that it doesn’t convert but renames in a way.
  2. I’ve been looking around with the GD library a little bit, but I can’t quite make it out.

    I’ll need an example.

  3. Because in their function they always wait in parameter a file,

    but I don’t think that putting image.jpg works, it looks more like you have to make a $file = fopen(image.jpg);

  4. I’m really struggling, and I can’t find any php script that does this conversion, based on…
  5. hard-boiled
  6. Yogui wrote: 18/04/2006 at 23:57 hours

Default


  1. You have to do something like this (simplified script, no security tests) :
  2. 1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

  3. WeDgEMasTeR wrote: 19/04/2006 at 00:30 am

Default


  1. Okay, I understand a little better.
  2. I just made a small correction:
  3. 1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

  4. Yogui wrote: 19/04/2006 at 00:45am

Default

  1. WeDgEMasTeR wrote: 19/04/2006 at 11:36 am

Default


  1. But can I just use your code, to convert to PNG ?
  2. My members are uploading, and I want it to save their image on PNG.
  3. So if the form is well filled, that it is indeed an image that he uploads.

    then I convert the image and insert the data into the DB.

  4. That’s basically enough?
You May Also Like