param('tab'); if ($service -> param('form_id_'.$tabella)) { $datiImg = $service -> getList($tabella,'',$service -> param('form_id_'.$tabella)); if (preg_match("/^cat_/",$tabella)) { $dirTabella = preg_replace("/^cat_/","",$tabella); $immagine = $service -> document_root."/img_".$dirTabella."/c_".$datiImg['id_'.$tabella]."/".$datiImg['img_'.$tabella]; } else { //$immagine = $service -> document_root."/file_ambientazioni/".$datiImg[id_file_ambientazioni]."/".$datiImg[id_file_ambientazioni]."".$datiImg[file_file_ambientazioni]; if ($service -> param('f')) { $imgTabella = $service -> param('f'); } else { $imgTabella = "img_".$tabella; } $immagine = $service -> document_root."/img_".$tabella."/".$datiImg['id_'.$tabella]."/".$datiImg[$imgTabella]; } } if (preg_match("/\.gif$/",$immagine)) { $gif = 1; Header("Content-type: image/gif"); } else if (preg_match("/\.png$/",$immagine)) { Header("Content-type: image/png"); $png = 1; } else { Header("Content-type: image/jpeg"); } if (file_exists($immagine)) { if ($gif == 1) { $image = imagecreatefromgif($immagine); } else if ($png == 1) { $image = imagecreatefrompng($immagine); } else { $image = imagecreatefromjpeg($immagine); } $w = imagesx($image); $h = imagesy($image); // $logo = imagecreatefromjpeg($service -> document_root."/img/logoPF.jpg"); // // $logow = imagesx($logo); // $logoh = imagesy($logo); // //allineato in basso a destra con margine di 10px // imagecopymerge($image, $logo, $w-($logow+10), $h-($logoh+10), 0, 0, $logow, $logoh, 60); // //CENTRATO NEL MEZZO ALL'IMMAGINE // $centerX = ($w/2)-($logow/2); // $centerY = ($h/2)-($logoh/2); // imageinterlace($image,1); list($width, $height) = getimagesize($immagine); // print $width." ".$height; // $new_width= $width * 0.1; // $new_height= $height * 0.1; $new_width= $service -> options['img_item_w']; //$new_height = $service -> options['img_box_h']; if ($width > $service -> options['img_item_w']) { $new_height = round(($height*$service -> options['img_item_w']) / $width); } if ($width < $service -> options['img_item_w']) { $new_height = round(($height*$service -> options['img_item_w']) / $width); } $image_p = imagecreatetruecolor($new_width, $new_height); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); if ($gif == 1) { ImageGIF($image_p); } else if ($png == 1) { ImagePNG($image_p); } else { ImageJPEG($image_p,'',70); } ImageDestroy($image); ImageDestroy($image_p); } ?>