Voting

: six minus two?
(Example: nine)

The Note You're Voting On

licson0729 at gmail dot com
13 years ago
I couldn't find any script that resize an image and give border to it. So I made one myself. Hope that can help you.

<?php
function imagecopyresizedwithborder(&$src,$width,$height,$borderthickess,$bordercolor=NULL)
{
list(
$width_orig, $height_orig) = array(imagesx($src),imagesy($src));

if (
$width && ($width_orig < $height_orig))
{
$width = ($height / $height_orig) * $width_orig;
}
else
{
$height = ($width / $width_orig) * $height_orig;
}

$dst = imagecreatetruecolor($width+2*$borderthickess,$height+2*$borderthickess);
imagecolortransparent($dst,imagecolorallocate($dst,0,0,0));
imagealphablending($dst,false);
imagesavealpha($dst,true);
imagefill($dst,0,0,(isset($bordercolor) ? $bordercolor : imagecolorallocate($dst,255,255,255)));
imagecopyresampled($dst,$src,$borderthickess,$borderthickess,0,0,$width,$height,imagesx($src),imagesy($src));
return
$dst;
}

?>

<< Back to user notes page

To Top