1)) || $folder==".."){ $folder=$folder."/"; } $web_img_name=$folder.$img_name; $local_img_name=realpath($web_img_name); $img_ext=substr(strrchr($img_name,"."),1); if($img_name!="" && file_exists($local_img_name)&&(($img_ext=="jpg")||($img_ext=="jpeg"))){ $img_type=getimagesize($local_img_name); $img_type=$img_type[2]; if ($img_type==2){ $file_ok="ok"; } } $web_folder_name=substr($web_img_name,0,(strlen($web_img_name)-strlen($img_name))); $local_folder_name=realpath($folder); if($local_folder_name!=""){ $local_folder_name=$local_folder_name."/"; } $thumb_name=$thumb_var.$thumb_width."_".$img_name; $local_thumb_name=$local_folder_name.$thumb_name; $web_thumb_name=$web_folder_name.$thumb_name; if(!file_exists($local_thumb_name)&&($file_ok=="ok")){ tcn_make_thumbnail($local_img_name,$local_thumb_name,$thumb_width); } if($file_ok="ok" && file_exists($local_thumb_name)){ $thumb_dimensions = getimagesize($local_thumb_name); $dimensions=$thumb_dimensions[3]; $popup_dimensions=getimagesize($local_img_name); $pop_width=$popup_dimensions[0]+30; $pop_height=$popup_dimensions[1]+30; if ($add_popup=="true"){ $link_start=""; $attr="border=\"0\" title=\"Click to enlarge\" alt=\"".$img_name."\" "; $call_script="onClick=\"window.open('$web_img_name','tcn_pop','fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=$pop_width,height=$pop_height,left=0,top=0');\""; $link_end=""; echo $link_start."".$link_end; }else{ echo ""; } }else{ if($alt_img!=""){ $alt_local_img=realpath($alt_img); $alt_dimensions = getimagesize($alt_local_img); echo (""); }else{echo("");} } } function tcn_make_thumbnail($image,$output_image,$thumb_width){ //$thumb_width; $img=imagecreatefromjpeg($image); $img_size=getimagesize($image); $proportion=$img_size[0]/$thumb_width; //gd1 and gd2 compatible if($thumbnail=@imagecreatetruecolor($img_size[0]/$proportion,$img_size[1]/$proportion)){ imagecopyresampled($thumbnail,$img,0,0,0,0,$img_size[0]/$proportion,$img_size[1]/$proportion,$img_size[0],$img_size[1]); }else{ $thumbnail=imagecreate($img_size[0]/$proportion,$img_size[1]/$proportion); imagecopyresized($thumbnail,$img,0,0,0,0,$img_size[0]/$proportion,$img_size[1]/$proportion,$img_size[0],$img_size[1]); } imagejpeg($thumbnail,$output_image); imagedestroy($img); imagedestroy($thumbnail); } ?>