gallery file upload problem php -
i have script:
if(($_post['number2'] && !$_post['button_add']) || ($_post['number2'] && !$_post['button_add_gal'])) { $num=$_post['number2']; for($p=0; $p<$num; $p++) { if ($_post['page']=='news') { $dir = '../images/news/'; // Директорията в която ще се записват файловете } if ($_post['page']=='gallery') { $dir = '../images/gallery/'; // Директорията в която ще се записват файловете } $name[$p]='gal_'.$_files['file']['name'][$p]; move_uploaded_file($_files['file']['tmp_name'][$p], $dir.$name[$p]); $filename[$p] = $name[$p]; if ($_post['page']=='news') { createthumb('../images'.directory_separator.'news'.directory_separator.$filename[$p]); echo '<img src="../images/news/thumb_'.$filename[$p].'" width="50" height="50" border="0" style="margin-left:10px;">'; } if ($_post['page']=='gallery') { createthumb('../images'.directory_separator.'gallery'.directory_separator.$filename[$p]); echo '<img src="../images/gallery/thumb_'.$filename[$p].'" width="50" height="50" border="0" style="margin-left:10px;">'; if($_post['page']=='gallery'){ resizeimage('../images'.directory_separator.'gallery'.directory_separator.$filename[$p]); } if ($_post['page']=='news'){ resizeimage('../images'.directory_separator.'news'.directory_separator.$filename[$p]); } } } } function createthumb($source, $thumb_width=150) { $fl = dirname($source); $new_name = 'thumb_'.basename($source); $img = imagecreatefromjpeg($source); $width = imagesx($img); $height = imagesy($img); $new_width = $thumb_width; $new_heght = floor($height * ($thumb_width / $width)); $tmp_img = imagecreatetruecolor( $new_width, $new_heght ); imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_heght, $width, $height); imagejpeg($tmp_img, $fl.directory_separator.$new_name); } function resizeimage($source, $thumb_width=700) { $fl = dirname($source); $new_name = basename($source); $img = imagecreatefromjpeg($source); $width = imagesx($img); $height = imagesy($img); $new_width = $thumb_width; $new_heght = floor($height * ($thumb_width / $width)); $tmp_img = imagecreatetruecolor( $new_width, $new_heght ); imagecopyresampled($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_heght, $width, $height); imagejpeg($tmp_img, $fl.directory_separator.$new_name); }
it works fine small pictures if use bigger pictures works 2 files. if attach 3 or more files upload them , when page refreshed, expecting see uploaded pictures there nothing on page. it's returned default state. not error message displayed. reconfigured php5.ini upload_max_filesize
100m still nothing.i use php5 file extensions , safe_mode switched off php5 cgi mode , gd2 active. problem?
i wonder if script timing out? add ini_set("max_execution_time", 500); or top of script , see if helps
Comments
Post a Comment