note 45457 added to function.imagejpeg
| From: | arjini at gmail dot com | Date: | Wed, 08 Sep 2004 01:48:46 +0000 |
| Subject: | note 45457 added to function.imagejpeg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76189@lists.php.net to get a copy of this message | ||
Converting a directory of PNG images into jpegs is as easy as:
<?php
$d = dir('./');
while(false !== ($e = $d->read())){
if(strpos($e,'.png')){
$r = imagecreatefrompng('./'.$e);
imagejpeg($r,str_replace('.png','.jpg',$e),75);
}
}
?>
Don't let anybody convince you otherwise. Put that in the folder that the images are in and run
it. I tried for 2 hours to get photoshop to do it, to no avail. PHP to the rescue!
----
Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45457
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45457&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45457&report=yes
Search -- http://master.php.net/manage/user-notes.php