Post
#1
|
|
|
Grupa: Zarejestrowani Postów: 9 Pomógł: 0 Dołączył: 9.07.2003 Ostrzeżenie: (0%)
|
Witam! Mam taki problem. Robię skalowanie zdjęć i wszytsko mi pieknie działa pod warunkiem, że sam proces skalowania nie jest wywoływany w funkcji. Kod wygląda jak poniżej.
[php:1:fdf1506183] # Constants define(IMAGE_BASE, "./gallery/users/" . $user . '/' . $album); define(MAX_WIDTH, 300); define(MAX_HEIGHT, 300); # Get image location $image_file = str_replace('..', '', $_SERVER['QUERY_STRING']); $image_path = IMAGE_BASE . "/$photo_name"; # Load image $img = null; $ext = strtolower(end(explode('.', $image_path))); if ($ext == 'jpg' || $ext == 'jpeg') { $img = @imagecreatefromjpeg($image_path); } else if ($ext == 'png') { $img = @imagecreatefrompng($image_path); # Only if your version of GD includes GIF support } else if ($ext == 'gif') { $img = @imagecreatefrompng($image_path); } # If an image was successfully loaded, test the image for size if ($img) { # Get image size and scale ratio $width = imagesx($img); $height = imagesy($img); $scale = min(MAX_WIDTH/$width, MAX_HEIGHT/$height); # If the image is larger than the max shrink it if ($scale < 1) { $new_width = floor($scale*$width); $new_height = floor($scale*$height); # Create a new temporary image $tmp_img = imagecreate($new_width, $new_height); # Copy and resize old image into new image imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagedestroy($img); $img = $tmp_img; } } # Create error image if necessary if (!$img) { $img = imagecreate(MAX_WIDTH, MAX_HEIGHT); imagecolorallocate($img,0,0,0); $c = imagecolorallocate($img,70,70,70); imageline($img,0,0,MAX_WIDTH,MAX_HEIGHT,$c2); imageline($img,MAX_WIDTH,0,0,MAX_HEIGHT,$c2); } # Display the image imagejpeg($img); [/php:1:fdf1506183] Co mogę robić źle? Dlaczego jak próbuje to wywołać z funkcją mającą wyświetlać miniaturki zdjęć wraz z opisem, to się wszystko krzaczy? Z góry dzieki za pomoc __________ php >> Skrypty Prosze uzywac znacznika [php] Seth |
|
|
|
Usagi miniatury zdjęć 29.09.2003, 18:02:49
DeyV podaj, jakie błedy sie pojawiaja, oraz zapodaj gdz... 29.09.2003, 18:31:47
Usagi Cytat˙Ř˙ŕJFIF˙ţ>CREATOR: gd-jpeg v1.0 (usi... 29.09.2003, 19:20:08
DeyV szkoda ze nie podałas gdzie mozna zobaczyc ten błę... 29.09.2003, 23:01:42
spenalzo CytatChoć myśle, że chodzi tu o to, że chcesz wyśw... 29.09.2003, 23:15:19
GeoS Od siebie dodam, ze wypadaloby poinformowac przegl... 30.09.2003, 00:35:15
Usagi Juz zrobilam, dziekuje za porady. Rzeczywiscie zab... 30.09.2003, 18:41:49 ![]() ![]() |
|
Aktualny czas: 7.01.2026 - 02:04 |