PNG to JPG script..

Discussion in 'Programming' started by elshazly, May 31, 2014.

  1. #1
    Hi, was curious in getting a png to jpg script.. either having someone from here create it and implement it, or if there is one out there I can implement into a site..

    Does anyone have any knowledge on png to jpg?
     
    elshazly, May 31, 2014 IP
  2. sincos

    sincos Active Member

    Messages:
    64
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    51
    #2
    is it transparent png?
    if true, what is background you you want?
     
    sincos, Jun 3, 2014 IP
  3. Jigney

    Jigney Active Member

    Messages:
    168
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    93
    #3
    you can use below function to convert the image from png to jpg

    function png2jpg($originalFile, $outputFile, $quality) {
    $image = imagecreatefrompng($originalFile);
    imagejpeg($image, $outputFile, $quality);
    imagedestroy($image);
    }
    For more information check below link :
    http://www.php.net/manual/en/imagick.setimageformat.php
     
    Jigney, Jun 5, 2014 IP