Dobrý den,
má script na uploadování obrázků, ale do adresáře mi to žádný obrázek neuloží. Adresář má nastaveno 777. Zasílám ukázku skriptu
$result = 0;
function resize_upload ($max_upload_width, $max_upload_height, $file,$name_foto,$t) {
if (($file == "image/jpeg" || $file == "image/pjpeg") && ($file < 2000000))
{
// if uploaded image was JPG/JPEG
if($file == "image/jpeg" || $file == "image/pjpeg"){
$image_source = imagecreatefromjpeg($file);
}
if ($t == 1) $thumb = "_t";
$remote_file = "/img-hlas/00002500/".$name_foto.$thumb;
imagejpeg($image_source,$remote_file,100);
chmod($remote_file,0644);
// get width and height of original image
list($image_width, $image_height) = getimagesize($remote_file);
if($image_width>$max_upload_width || $image_height >$max_upload_height){
$proportions = $image_width/$image_height;
if($image_width>$image_height){
$new_width = $max_upload_width;
$new_height = round($max_upload_width/$proportions);
}
else{
$new_height = $max_upload_height;
$new_width = round($max_upload_height*$proportions);
}
$new_image = imagecreatetruecolor($new_width , $new_height);
$image_source = imagecreatefromjpeg($remote_file);
imagecopyresampled($new_image, $image_source, 0, 0, 0, 0, $new_width, $new_height, $image_width, $image_height);
imagejpeg($new_image,$remote_file,100);
imagedestroy($new_image);
}
imagedestroy($image_source);
$result = 1;
}
}
na který odkazuji:
resize_upload(500,500,$_FILES,$hlas_id_foto,0);
díky za rady
3. 9. 2011 09:54:29