Billede upload har svært ved at uploade filer
Jeg har lavet et upload-script, men nogle folk har store problemer med at uploade større filer (600-1000 KB og opad). Jeg overvejer at tage en snak med webhotellet, men jeg vil godt lige høre, om der kan optimeres noget ved min kode først:$filename = str_replace(array('æ','ø','å','Æ','Ø','Å'),array('ae','oe','aa','ae','oe','aa'),strtolower($_FILES['picture']['name']));
$tmp_name = $_FILES['picture']['tmp_name'];
$target = 'images/pictures/'.$filename;
move_uploaded_file($tmp_name, $target);
$imagepath = $filename;
$save = 'images/pictures/_thumb/'.$imagepath; //This is the new file you saving
$file = 'images/pictures/'.$imagepath; //This is the original file
list($width, $height) = getimagesize($file);
$modheight = 100;
$diff = $height / $modheight;
$modwidth = $width / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight);
$image = imagecreatefromjpeg($file);
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height);
imagejpeg($tn, $save, 100);
$picture2 = 'images/pictures/_thumb/'.$imagepath;
// Full size
$save = 'images/pictures/'.$imagepath; //This is the new file you saving
$file = 'images/pictures/'.$imagepath; //This is the original file
list($width, $height) = getimagesize($file);
$modwidth = 485;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight);
$image = imagecreatefromjpeg($file);
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height);
imagejpeg($tn, $save, 100);
På forhånd tak!