Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
StefanDi  
#1 Posted : Sunday, April 6, 2008 1:00:03 AM(UTC)
StefanDi

Rank: Member

Groups: Member
Joined: 12/20/2006(UTC)
Posts: 9

Hello,

I hope you can help me.
When I cancel the upload while uploading pictures, the uploadskript stops immediately (I think).
Thats a problem, because I calculate from the uploaded Picture 2 Thumnails. But when I cancel the upload, it could be happen that only one Thumbnail was created or no one. What cann I do, that the process end correctly.

Thank you,

greets Stefan







//Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
$thumbnail1Field = "Thumbnail1_" . $i;
move_uploaded_file($_FILES[$thumbnail1Field]["tmp_name"],
$galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_n.jpg");



// Calculate
list ($w_new, $h_new) = CalculateImageSize($Width, $Height, 180, 120);
$imgh2 =ImageCreateFromJPEG($galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_n.jpg");
$imgsz = getimagesize($galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_n.jpg");
$imgh = imagecreatetruecolor($w_new,$h_new);
ImageCopyResampled($imgh, $imgh2, 0,0,0,0,$w_new,$h_new,$imgsz[0],$imgsz[1]);
imagejpeg($imgh,$galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_m.jpg",100);
imagedestroy ($imgh);


list ($w_new, $h_new) = CalculateImageSize($Width, $Height, 80, 70);
$imgh2 =ImageCreateFromJPEG($galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_m.jpg");
$imgsz = getimagesize($galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_m.jpg");
$imgh = imagecreatetruecolor($w_new,$h_new);
ImageCopyResampled($imgh, $imgh2, 0,0,0,0,$w_new,$h_new,$imgsz[0],$imgsz[1]);
imagejpeg($imgh,$galleryPath . $path. "/" . $Gallery_id ."/". $fileName . "_s.jpg",100);
imagedestroy ($imgh);
Fedor  
#2 Posted : Sunday, April 13, 2008 3:25:34 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
It is better to save first thumbnails to temp place and place them to final place only on last thumbnail arriving. If the last thumbnail has not arrived you can just delete thumbnails from temp place.
Best regards,
Fedor Skvortsov
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.