Technology
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Host By : Shwe Yaung Myanmar
 
HomeAdvertisingSearchLatest imagesRegisterLog inAdvertising Space

 

 Create thumbnails for large images

Go down 
AuthorMessage
Admin
Admin



Posts : 49
Join date : 2008-01-09

Create thumbnails for large images Empty
PostSubject: Create thumbnails for large images   Create thumbnails for large images EmptySun Apr 06, 2008 7:18 am

<?php
$filename = $_GET['file'];
$percent = 0.2;
$font = "arial";
$fontsize = 7;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
$image_p = imagecreatetruecolor($new_width + 2, $new_height + 20);


$backgroundcolor = imagecolorallocate($image_p,5,90,177);
$background = imagefill($image_p,0,0,$backgroundcolor);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 1, 1, 0, 0, $new_width, $new_height, $width, $height);
$tcolor = imagecolorallocate($image_p,255,255,255);
$t = "CLICK TO ENLARGE " . $width . "x" . $height;
$fontwidth = imagettfbbox($fontsize,0,$font,$t);
$g = abs($fontwidth[1]) + abs($fontwidth[2]);

imagettftext($image_p,$fontsize,0,$new_width / 2 - ($g / 2),$new_height + 14,$tcolor,$font,$t);
imagejpeg($image_p, null, 100);
?>
Back to top Go down
https://shweyaungmyanmar.board-directory.net
 
Create thumbnails for large images
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Technology :: Web Technology Zone :: PHP Script-
Jump to: