Ajax
ASP
C,C++
C#,.NET
CSS,HTML
Delphi,Kylix
Experience
Flash
Java
JavaScript
PHP
Python
QT
SQL
ShellScript
VB
U :
P :
Register
Lost Password
Other Links
Code Archive
Save Giovanni
PHP Category Code
Real Name
:
Erden
Subject
:
Create a Thumbnail
Description
:
resmin yüksekliğini veya genişlini verdiniz orana göre tekrar kaydetmek için kullanabilirsiniz.
<?php function image_create_thumb($filename, $width, $height) { list($image["Width"], $image["Height"], $image["Type"]) = getimagesize($filename); switch($image["Type"]) { case IMG_JPG: case IMG_JPEG: $im_image = ImageCreateFromJPEG($filename); break; case IMG_GIF: $im_image = ImageCreateFromGIF($filename); break; case IMG_PNG: $im_image = ImageCreateFromPNG($filename); break; } if($image["Width"] > $image["Height"]) { $scale = $width / $image["Width"]; $thumb_width = $width; $thumb_height = floor($image["Height"]*$scale); } else { $scale = $height / $image["Height"]; $thumb_height = $height; $thumb_width = floor($image["Width"]*$scale); } $im_thumb = @ImageCreateTrueColor($thumb_width, $thumb_height) or die("Cannot Initialize new GD image stream"); ImageCopyResized($im_thumb, $im_image, 0, 0, 0, 0, $thumb_width, $thumb_height, $image["Width"], $image["Height"]); ImageDestroy($im_image); ImagePNG($im_thumb, $filename); ImageDestroy($im_thumb); return true; }//image_create_thumb($filename, $width, $height) ?>
Rating
:
0.00
(out of 5)
Visitor Voting Booth
:
Excellent
Very Good
Good
Fair
Poor
Copyright © 2006 SharingCode.NET . All rights reserved. Hosted By: SisNetworks