[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Converting PNG to GIF or JPG

Posted on 2004-09-03
3
Medium Priority
?
4,411 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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 look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

649 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