Posted by k Sat 17th Mar 2007 22:48 - Syntax is PHP - 23 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
PHP parser reported no syntax errors in this post!
-
function backstr($haystack, $needle) {
-
}
-
-
// Return random image code
-
-
function image_createThumb($src,$dest,$maxWidth,$maxHeight,$quality=100) {
-
// path info
-
-
// image src size
-
-
// image dest size $destSize = width, $destSize = height
-
$srcRatio = $srcSize[0]/$srcSize[1]; // width/height ratio
-
$destRatio = $maxWidth/$maxHeight;
-
if ($destRatio > $srcRatio) {
-
$destSize[1] = $maxHeight;
-
$destSize[0] = $maxHeight*$srcRatio;
-
}
-
else {
-
$destSize[0] = $maxWidth;
-
$destSize[1] = $maxWidth/$srcRatio;
-
}
-
-
// path rectification
-
if ($destInfo['extension'] == "gif") {
-
}
-
-
// true color image, with anti-aliasing
-
$destImage = imageCreateTrueColor($destSize[0],$destSize[1]);
-
imageAntiAlias($destImage,true);
-
-
// src image
-
switch ($srcSize[2]) {
-
case 1: //GIF
-
$srcImage = imageCreateFromGif($src);
-
break;
-
-
case 2: //JPEG
-
$srcImage = imageCreateFromJpeg($src);
-
break;
-
-
case 3: //PNG
-
$srcImage = imageCreateFromPng($src);
-
break;
-
-
default:
-
return false;
-
break;
-
}
-
-
// resampling
-
imageCopyResampled($destImage, $srcImage, 0, 0, 0, 0,$destSize[0],$destSize[1],$srcSize[0],$srcSize[1]);
-
-
// generating image
-
switch ($srcSize[2]) {
-
case 1:
-
case 2:
-
imageJpeg($destImage,$dest,$quality);
-
break;
-
-
case 3:
-
imagePng($destImage,$dest);
-
break;
-
}
-
return true;
-
}
-
else {
-
return false;
-
}
-
}
-
function _execute_image_thumb($src, $dst, $height, $width) {
-
image_createThumb($src, $dst,$height,$width);
-
}
-
PermaLink to this entry https://pastebin.co.uk/11965
Posted by k Sat 17th Mar 2007 22:48 - Syntax is PHP - 23 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0