![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 21 Pomógł: 1 Dołączył: 27.01.2009 Ostrzeżenie: (0%) ![]() ![]() |
Kod <?php print '<form action="upload4.php" method="post" enctype="multipart/form-data"> <input type="file" name="image" /> <input type="submit"></form>'; if ($_FILES['image']['tmp_name'] != '') { print $_FILES['photo_1']['name'].'<br>'; $image_to_be_resized = imagecreatefromjpeg($_FILES['image']['tmp_name']); $location = 'photo/'.$_FILES['image']['name']; move_uploaded_file($_FILES['image']['tmp_name'], $location); $width_of_new_image = 116; $height_of_new_image = 119; $destination_image = imagecreate($width_of_new_image, $height_of_new_image); $offset_x = 0; $offset_y = 0; $offset_old_x=0; $offset_old_y=0; $crop_width = 116; $crop_height=119; imagecopy($destination_image, $image_to_be_resized, $offset_x, $offset_y, $offset_old_x, $offset_old_y, $crop_width, $crop_height); $offset_x = 0; $offset_y = 0; $offset_old_x=0; $offset_old_y=0; $crop_width = imagesx($image_to_be_resized); $crop_height= imagesy($image_to_be_resized); $new_width = 116; $new_height = 119; imagecopyresampled($destination_image, $image_to_be_resized, $offset_x, $offset_y, $offset_old_x, $offset_old_y, $new_width, $new_height, $crop_width, $crop_height); imagejpeg($destination_image, 'photo/thumb'.$_FILES['image']['name'], 100); print '<a href="photo/'.$_FILES['image']['name'].'">Oryginal</a><br>'; print '<a href="photo/thumb'.$_FILES['image']['name'].'">Thumb</a><br>'; } ?> Skrypt działa tak jak powinien, ale jest jedno ale... mimo ustawienia jakości zdjęcia przy imagejpeg na 100, otrzymana miniaturka jest bardzo niskiej jakości - przykładowo: http://img24.imageshack.us/my.php?image=je...ajobraz1vv0.jpg daje http://img132.imageshack.us/my.php?image=t...mnkrajobcs0.jpg Ten post edytował Ramadisu 6.02.2009, 14:07:24 |
|
|
![]() |
![]()
Post
#2
|
|
![]() Grupa: Moderatorzy Postów: 8 989 Pomógł: 1550 Dołączył: 8.08.2008 Skąd: Słupsk/Gdańsk ![]() |
Zamiast image_create uzyj http://pl.php.net/manual/pl/function.image...tetruecolor.php
Ten post edytował wookieb 6.02.2009, 14:08:42 -------------------- |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 12:40 |