Source for file thumb.php
Documentation is available at thumb.php
* Genera i thumbnail (diapositive) per le immagini allegate.
* Viene richiamato dal file {@link add.attach.php}
* @author Mario Marcello Verona <marcelloverona@gmail.com>
* @copyright 2007 Mario Marcello Verona
* @license http://www.gnu.org/licenses/gpl.html GNU Public License
require ("./inc/conn.php");
list ($org_width,$org_height,$orgtype) = getimagesize($imgfile);
$div_width = $org_width / $max_width;
$div_height = $org_height / $max_height;
if($div_width >= $div_height) {
$new_height = round($org_height / $div_width);
$new_height = $max_height;
$new_width = round($org_width / $div_height);
case 1: $im = imagecreatefromgif($imgfile); break;
case 2: $im = imagecreatefromjpeg($imgfile); break;
case 3: $im = imagecreatefrompng($imgfile); break;
$tn = imagecreatetruecolor($new_width,$new_height);
imagecopyresized($tn,$im,0,0,0,0,$new_width,$new_height,$org_width,$org_height);
case 1: header("Content-Type: image/gif"); imagegif($tn); break;
case 2: header("Content-Type: image/jpeg"); imagejpeg($tn); break;
case 3: header("Content-Type: image/png"); imagepng($tn); break;
|