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

Notification

Icon
Error

Options
Go to last post Go to first unread
rjfmjanssen  
#1 Posted : Saturday, November 13, 2010 11:16:27 AM(UTC)
rjfmjanssen

Rank: Newbie

Groups: Member
Joined: 11/13/2010(UTC)
Posts: 1

First of all, this is a great application !.

The problem I have is the following. We need to upload a resized image and create two thumbnails of it. So fas as I understand is the only way to resize images via a converter. But when I create two converters for thumbs they overwritten each other.

Code:

  $uploader = new ImageUploaderFlash();
  $uploader->setID("imageUploader");
  $uploader->setWidth("420px");
  $uploader->setHeight("350px");
  
  // specify a license key
  $uploader->setLicenseKey("trial version");
  
  
  // configure upload settings
  $uploader->getUploadSettings()->setActionUrl("upload.php");
  //$uploader->getUploadSettings()->setRedirectUrl("catalog.php");
  
  
  //configure uploaded files
  $converters = &$uploader->getConverters();
  // one converter for uploading source file
  $converter = new Converter();
  $converter->setMode("*.*=SourceFile");
  $converters[] = $converter;
  
  $converter = new Converter();
  $converter->setMode("*.*=Thumbnail");
  // set thumbnail size
  $converter->setThumbnailWidth(800);
  $converter->setThumbnailHeight(600);
  $converter->setThumbnailFitMode("fit");
  
  // and second - for uploading thumbnail
  $converter = new Converter();
  $converter->setMode("*.*=Thumbnail");
  // set thumbnail size
  $converter->setThumbnailWidth(120);
  $converter->setThumbnailHeight(120);
  $converter->setThumbnailFitMode("fit");
  $converters[] = $converter;


I use the example code that is available in the chm file.
Questions:

1) How do I get two different sizes thumbnails of the original file.
2) How can I resize the original file (only via a thumb converter?)
3) How do I get the thumb and image names back for using in a form. (When I send a form to the server for saving a record with references to these created images.)

Thanks for the answers !
Dmitry.Obukhov  
#2 Posted : Sunday, November 14, 2010 11:04:55 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups:
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Hello Roy,

Thanks for your comments about Flash Uploader.

Here are my answers:
  1. I looked through your code you provided. Firstly, you should add this line for converter 800x600:
    Code:
     $converters[] = $converter;

    Then, you need to correct server-side script to save the both thumbnails:
    Code:
    
    //Save 1st thumbnail.
    $thumbnailFile = $convertedFiles[1];
    $thumbnailFileName = GetSafeFileName($absThumbnailsPath, rawurlencode($file->getSourceName()) . '.jpg');
    $thumbnailFile->saveAs($absThumbnailsPath . $thumbnailFileName);
    //Save 2st thumbnail.
    $thumbnailFile = $convertedFiles[2];
    $thumbnailFileName = GetSafeFileName($absThumbnailsPath, rawurlencode($file->getSourceName()) . '.jpg');
    $thumbnailFile->saveAs($absThumbnailsPath . $thumbnailFileName); 
  2. You can resize images using converters only.
  3. As far as I understand, you want to show uploaded image thumbnails with their names after upload (in a sense a gallery of images). I attached simple application based on your script to this post, which allows resizing images, saving both thumbnails, and showing the gallery page after upload. Please download and try it out.
If you have any additional questions or problems, please feel free to el tem know.
File Attachment(s):
PHPSample.zip (484kb) downloaded 7 time(s).
Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
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.