MYHTML; $new_w = 80; $new_h=50; $main_path = $_GET['main']; $foto = $_GET['foto']; $punto = strrpos($foto,"."); $sub_path = substr($foto,0,$punto); $image_stats = GetImageSize($main_path."/".$foto); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]+8; //$filetext1 = $sub_path."-sx.txt"; $filetext1 = $sub_path.".txt"; if (file_exists($main_path."/descrizione/".$filetext1)) { $file_open = ($main_path."/descrizione/".$filetext1); $testo1 = implode('', file($file_open)); } else { $testo1=""; } //$filetext2 = $sub_path."-dx.txt"; //if (file_exists($main_path."/descrizione/".$filetext2)) { //$file_open = ($main_path."/descrizione/".$filetext2); //$testo2 = implode('', file($file_open)); //}else { //$testo2=""; //} $particolari_path = $main_path."/particolari"."/".$sub_path; $thumb_path = $particolari_path."/thumb"; $media_path = $particolari_path."/media"; $dir = dir($particolari_path); $dirmedia = dir($media_path); //$entrymedia = scandir($dirmedia); // only works in PHP 5 $testo2=""; while (false !== ($entrymedia=$dirmedia->read())) { if (filetype($media_path.'/'.$entrymedia) == 'file'){ if($entrymedia == "." || $entrymedia == ".."){ continue; } $rinominamedia=rinomina($entrymedia); rename($media_path.'/'.$entrymedia,$media_path.'/'.$rinominamedia); $entrymedia=$rinominamedia; $titolo_media = str_replace ("_", " ", $entrymedia); $titolo_media = str_replace ("--", "'", $titolo_media); if (!empty($titolo_media)) { $testo2 = "$testo2" . "" . "$titolo_media" . "
"; } } } $titolo = str_replace ("_", " ", $sub_path); $titolo = str_replace ("--", "'", $titolo); //echo "

$sub_path


"; print <<$titolo
Click per tornare indietro $testo2

MYHTML; while (false !== ($entry=$dir->read())) { if (filetype($particolari_path.'/'.$entry) == 'file'){ if($entry == "." || $entry == ".."){ continue; } $rinominafoto = rinomina($entry); rename($particolari_path.'/'.$entry,$particolari_path.'/'.$rinominafoto); $entry = $rinominafoto; $photo_filename = "$entry"; $image_stats = GetImageSize($particolari_path."/".$entry); $imagewidth = $image_stats[0]; $imageheight = $image_stats[1]; $img_type = $image_stats[2]; if (!file_exists($thumb_path."/".$entry)) { if ($img_type=="2") { $src_img = imagecreatefromjpeg($particolari_path."/".$entry); $dst_img=ImageCreateTrueColor($new_w,$new_h); imagecopyresampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); imagejpeg($dst_img, "$thumb_path"."/$entry"); } elseif ($img_type=="1") { $src_img = imagecreatefromgif($particolari_path."/".$entry); $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img)); imagejpeg($dst_img, "$thumb_path"."/$entry"); } } print << function popMe(mypicpath) { window.open("particolare.htm?"+mypicpath,"null","left=0,top=0,width=200,height=200,resizable=0,location=0,menubar=0,scrollbars=0,status=0,toolbar=0"); } $entry MYHTML; } } print <<
MYHTML; ?>