Solved

Converting PNG to GIF or JPG

Posted on 2004-09-03
3
4,396 Views
Last Modified: 2010-10-05
Hi,

I have a series of PNG files and i want to convert these PNG files to GIF (or JPG) file formats. How can i do this with PHP?

Thanks in advance,
0
Comment
Question by:blacklord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 125 total points
ID: 11970996
<?php

$imgname = 'mypic.png';
$im = @imagecreatefrompng($imgname);
header ("Content-type: image/jpeg");
$quality = 99; // Quality should be between 0 and 100
imagejpeg($im, '', $quality);

?>

http://www.php.net/imagejpeg
0
 
LVL 4

Expert Comment

by:chipple
ID: 11971011
By the way, recent version of GD (PHP's graphic library) don't support GIF.
0
 
LVL 33

Expert Comment

by:sajuks
ID: 11978509
Thanks for the points and grade
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question