HighDots Forums  

Creating a PNG thumbnail

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Creating a PNG thumbnail in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AngryCloud
 
Posts: n/a

Default Creating a PNG thumbnail - 07-05-2008 , 04:47 PM






I use the following PHP code to create a JPEG thumbnail from a JPEG image. How
can I modify this code to create a PNG thumbnail from a PNG image?



$image_p = imagecreatetruecolor($thumb_width, $thumb_height);
$image = imagecreatefromjpeg($thumbnail);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $thumb_width, $thumb_height,
$thumb_width_orig, $thumb_height_orig);
imagejpeg($image_p, $thumbnail_source, 100);


Reply With Quote
  #2  
Old   
Murray *ACE*
 
Posts: n/a

Default Re: Creating a PNG thumbnail - 07-05-2008 , 04:59 PM






http://www.php.net/manual gives this code snippet -

<?php
header("Content-type: image/png");
$im = @imagecreate(110, 20)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================

"AngryCloud" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
I use the following PHP code to create a JPEG thumbnail from a JPEG image.
How
can I modify this code to create a PNG thumbnail from a PNG image?



$image_p = imagecreatetruecolor($thumb_width, $thumb_height);
$image = imagecreatefromjpeg($thumbnail);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $thumb_width,
$thumb_height,
$thumb_width_orig, $thumb_height_orig);
imagejpeg($image_p, $thumbnail_source, 100);



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.