Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert jpg image to gif, png & bmp format using PHP

Tags:

How can I convert a single jpg image into 3 different image format gif , png and bmp using PHP?

Pls help

like image 674
riad Avatar asked Apr 16 '09 11:04

riad


Video Answer


2 Answers

You first create an image object out of your file with imagecreatefromjpeg(). You then dump that object into different formats (using imagegif() for example):

$imageObject = imagecreatefromjpeg($imageFile);
imagegif($imageObject, $imageFile . '.gif');
imagepng($imageObject, $imageFile . '.png');
imagewbmp($imageObject, $imageFile . '.bmp');
like image 62
soulmerge Avatar answered Oct 19 '22 17:10

soulmerge


Use libGD — http://www.php.net/manual/en/book.image.php

like image 34
vartec Avatar answered Oct 19 '22 15:10

vartec