Mam taki problem napisałem tak skrypcik do skalowania zdjęć po odpaleniu go otrzymuję tak błąd :
Sprawdzałem z wpisaniem id zdjęcia na sztywno.
plik na pewno jest w katalogu .
Jak kasuje slesze w ścieżce lub dodaję kropki nic to nie zmienia. /photos/orginal/1.jpg, ./photos/orginal/1.jpg obydwa przypadki nie działają
Hosting na nazwa.pl
Warning: getimagesize(/photos/orginal/1.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /.../fns/photo_fns.php on line 6
Warning: getimagesize(/photos/orginal/1.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /.../fns/photo_fns.php on line 8
CODE
<?php
function resize_image($thumbnail = false,$id,$width,$height,$quality)
{
$image = ".photos/orginal/$id.jpg";
list($image_width,$image_height) = getimagesize($image);
$check_mime = getimagesize($image);
if($check_mime['mime'] != 'image/jpeg')
{
return false;
}
if($thumbnail == false)
{
$ratio_orginal = $image_width / $image_height;
if($width / $height > $ratio_orginal)
{
$width = $width * $ratio_orginal;
}
else
{
$height = $height / $ratio_orginal;
}
if(!file_exists("/photo/small"))
{
mkdir("/photo/small");
}
$directory = "/photo/small/$id.jpg";
}
else
{
if(!file_exists("/photo/thumbnail"))
{
mkdir("/photo/thumbnail");
}
$directory = "/photo/thumbnail/$id.jpg";
}
$orginal = imagecreatefromjpeg($image);
$canvas = imagecreatetruecolor($width, $height);
imagecopyresampled($canvas,$image, 0, 0, 0, 0, $width, $height, $image_width, $image_height);
if(imagejpeg($canvas,$directory,$quality))
{
return true;
}
else
{
return false;
}
return true;
}
?>
function resize_image($thumbnail = false,$id,$width,$height,$quality)
{
$image = ".photos/orginal/$id.jpg";
list($image_width,$image_height) = getimagesize($image);
$check_mime = getimagesize($image);
if($check_mime['mime'] != 'image/jpeg')
{
return false;
}
if($thumbnail == false)
{
$ratio_orginal = $image_width / $image_height;
if($width / $height > $ratio_orginal)
{
$width = $width * $ratio_orginal;
}
else
{
$height = $height / $ratio_orginal;
}
if(!file_exists("/photo/small"))
{
mkdir("/photo/small");
}
$directory = "/photo/small/$id.jpg";
}
else
{
if(!file_exists("/photo/thumbnail"))
{
mkdir("/photo/thumbnail");
}
$directory = "/photo/thumbnail/$id.jpg";
}
$orginal = imagecreatefromjpeg($image);
$canvas = imagecreatetruecolor($width, $height);
imagecopyresampled($canvas,$image, 0, 0, 0, 0, $width, $height, $image_width, $image_height);
if(imagejpeg($canvas,$directory,$quality))
{
return true;
}
else
{
return false;
}
return true;
}
?>
Pozdrawiam i proszę o pomoc.
Piotr .