Languages :: PHP :: php and tif |
|||
| By: roe1and |
Date: 16/04/2008 12:49:24 |
Points: 20 | Status: Answered Quality : Excellent |
|
i want to use the script below to copy/resize images. will it work with tif images. i've been looking on php.net at all these: # imagecreate # imagecreatefromgd2 # imagecreatefromgd2part # imagecreatefromgd # imagecreatefromgif # imagecreatefromjpeg # imagecreatefrompng # imagecreatefromstring # imagecreatefromwbmp # imagecreatefromxbm # imagecreatefromxpm # imagecreatetruecolor does this mean no support for tif? the code i'm looking at: <?php $source_pic = 'images/source.jpg'; $destination_pic = 'images/destination.jpg'; $max_width = 500; $max_height = 500; $src = imagecreatefromjpeg($source_pic); list($width,$height)=getimagesize($source_pic); $x_ratio = $max_width / $width; $y_ratio = $max_height / $height; if( ($width <= $max_width) && ($height <= $max_height) ){ $tn_width = $width; $tn_height = $height; }elseif (($x_ratio * $height) < $max_height){ $tn_height = ceil($x_ratio * $height); $tn_width = $max_width; }else{ $tn_width = ceil($y_ratio * $width); $tn_height = $max_height; } $tmp=imagecreatetruecolor($tn_width,$tn_height); imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height); imagejpeg($tmp,$destination_pic,100); imagedestroy($src); imagedestroy($tmp); ?> |
|||
| By: VGR | Date: 17/04/2008 13:56:50 | Type : Answer |
|
| yes, PHP (or, rather, the GD "standard" library )has two TIFF constants but doesn't seem to be able to work on TIFF (tagged-image format) You should read this PHP GD Manual entry about TIFF and smile ;-) You'll probably have to install Imagick, which is different (more powerful?) than GD. It shouldn't be a problem, even on Windows HTH |
|||
|
Do register to be able to answer |
|||
| Add This Article To: | |||
| |
|
|
|
| |
|
|
|









