/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function set_thumb($file, $photos_dir=�uploads/photos�,$thumbs_dir=�uploads/photos/thumbs�, $square_size=167, $quality=100) { //check if thumb exists //get image info //set dimensions if($width> $height) { $width_t=$square_size; //respect the ratio //set the offset $off_x=0; } elseif($height> $width) { $height_t=$square_size; $off_y=0; } else { $width_t=$height_t=$square_size; $off_x=$off_y=0; } //default background is black } }