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

Notification

Icon
Error

Options
Go to last post Go to first unread
ssjdoob  
#1 Posted : Thursday, September 23, 2010 12:04:46 AM(UTC)
ssjdoob

Rank: Newbie

Groups: Member
Joined: 7/24/2010(UTC)
Posts: 7

Hi, I'm considering purchasing the Image Uploader. I haven't even downloaded it, but I will need it to do a couple things that I'm not sure if it can do based on what details I've been able to find on this site.

1. Store 3 different files in S3: fullsize, websize and thumbnail. I saw this on another post so I think I'm ok here.

2. Set the filename of the image to be the CustomerID_hhmmss_originalfilename.jpg. Since all customer's images will be stored in the same buckets I need to do this to prevent any image name duplications.

3. Store the new filenames in a database table so I will know that they have been uploaded and apply to this customer. I just need to know that there is a place for me to get this information and a slot in the process that allows me to insert a function that can do this.

Thanks!
Dru
Fedor  
#2 Posted : Thursday, September 23, 2010 6:44:54 PM(UTC)
Fedor

Rank: Advanced Member

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

Thanks: 5 times
Was thanked: 62 time(s) in 61 post(s)
First of all I recommend to check the general information about cloud uploading:

Uploading to Cloud Storages

Please check the standard Amazon S3 examples also:

Amazon S3 Demo Sample
Amazon S3 Images Demo Sample


Quote:
1. Store 3 different files in S3: fullsize, websize and thumbnail. I saw this on another post so I think I'm ok here.


Yes, it is possible. Please View post for more info.

Quote:
2. Set the filename of the image to be the CustomerID_hhmmss_originalfilename.jpg. Since all customer's images will be stored in the same buckets I need to do this to prevent any image name duplications.


Amazon S3 storage doesn’t support file names. It identifies the object in a bucket by a key, which can look like a file path, but it is just a key. So, you can modify the Key property to append a customer id if before a file name:

JavaScript
Code:
as3.getSourceFile().setKey("SOME_CUSTOMER_ID-${filename}");


ASP.NET
Code:
<aur:AmazonS3Extender ID="AmazonS3Extender1" runat="server" 
    ImageUploaderID="ImageUploader1" 
    AWSAccessKeyId="<%$ _AWSAccessKeyId %>"
    SecretAccessKey="<%$ _SecretAccessKey %>"
    Bucket="<%$ _Bucket %>"                 
>
    <SourceFile Acl="<%$ _acl %>" Key="SOME_CUSTOMER_ID-${filename}">
        <aur:PredefinedMetaProperty Name="imagewidth"  Field="Width_[ItemIndex]" />
        <aur:PredefinedMetaProperty Name="imageheight"  Field="Height_[ItemIndex]" />
        <aur:CustomMetaProperty Name="author" Value="John Smith" />
    </SourceFile>                   
</aur:AmazonS3Extender>


PHP
Code:
<?php

    $iu = new ImageUploader('ImageUploader1', 650, 400);

    $as3 = new AmazonS3Extender($iu);

    $as3->setAWSAcceccKeyId($amazon_AWSAccessKeyId);
    $as3->setBucket($amazon_Bucket);
    $as3->setSecretAccessKey($amazon_SecretAccessKey);
    $as3->getSourceFile()->setAcl($acl);
    $as3->getSourceFile()->setKey($destination_folder .'SOME_CUSTOMER_ID-${filename}');

    $as3->getSourceFile()->addMetaProperty(new PredefinedMetaProperty("imagewidth", "Width_[ItemIndex]"));
    $as3->getSourceFile()->addMetaProperty(new PredefinedMetaProperty("imageheight", "Height_[ItemIndex]"));
    $as3->getSourceFile()->addMetaProperty(new CustomMetaProperty("author", "John Smith"));

    $iu->render();
  ?>


Quote:
3. Store the new filenames in a database table so I will know that they have been uploaded and apply to this customer. I just need to know that there is a place for me to get this information and a slot in the process that allows me to insert a function that can do this.


After upload to Amazon S3 you can redirect to another page, iterate Amazon S3 bucket, and add new uploaded files to the database. Please note, this code is not part of Image Uploader and you need to implement yourself.

To prevent iterating over numerous files on Amazon S3 storage, you can upload files with keys following a some pattern:

Example:
Code:
'SOME_CUSTOMER_ID/UPLOAD_SESSION_ID/${filename}'


Then you you can specify a prefix in a call of ListBucket method:

Code:
Prefix = "SOME_CUSTOMER_ID/UPLOAD_SESSION_ID/"



Alternatively, you can obtain file names in JavaScript and then save them in database using postback or AJAX approaches. You can find an example in the following topic:

http://forums.aurigma.com/yaf_p...ader-with-Amazon-S3.aspx
Best regards,
Fedor Skvortsov
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.