1 (edited by peco 2011-09-26 20:48:01)

Topic: 2 versions of and image

Hi all, i want to upload and image, and in the upload event transform it to 2 different files, with different sizes.
for Example:
Original File: MyPhoto.jpg,   width: 200 Height: 100
i want upload 2 files:
MyPhoto1.jpg  width: 100 height: 50
and
MyPhoto2.jpg  width: 50 height: 25

how i do that???

i use:
$("#flash_uploader").pluploadQueue({
        runtimes : 'flash',
        url : '../upload.php',
        max_file_size : '10mb',
        chunk_size : '1mb',
        unique_names : true,
        multiple_queues : true,
        sortable: true,
        // Resize images on clientside if we can
        resize : {width : 100, height : 50, quality : 90},
        flash_swf_url : '../../js/plupload.flash.swf',
       
    });


that upload just one file, with 100x50 size, i want to uploar the other one, with 50x25px dimensions.  sad
thanks

Re: 2 versions of and image

@peco,

I'm using PHPThumb at the server side, so i am creating 4 thumbs with different dimensions.

It isn't complicated, if you want to know more about it, the url is:

http://phpthumb.gxdlabs.com

Re: 2 versions of and image

Thank masi, i use some similar to does, the problem is that en the upload.php file i dont know where put the resize function line.

When i upload i have Chunk and not chunk files.

Re: 2 versions of and image

@peco,

Considering the original file of upload.php (version 1.5), i think you should use the PHPThumb or similar, at the line 120.

Re: 2 versions of and image

Ok masimao. I would do it and comment my progress!
Thanks again.

Re: 2 versions of and image

Wich file u use for the resize, the upload one or the temporal file?

In previus Lines we got: @unlink($_FILES['file']['tmp_name']);

By the way, in code i have a mysql insert, like this...
if($fileName!=$_SESSION['unique_name']){
     insert statmentes....
     $_SESSION['unique_name']=$fileName;
}

Re: 2 versions of and image

I recomend you to use the file uploaded by Plupload. If the upload happens succesfully you can acess it using:

$targetDir . DIRECTORY_SEPARATOR . $fileName

Re: 2 versions of and image

Exellent masimao, it works!
Many thanks!! smile

Re: 2 versions of and image

I have the same problem, but a little complicated as I upload directly to S3. Is there a way to do it. If not has anyone able to hack a solution for it.

I thought of 2 options

1. Client --> My Server (Create thumbnail) --> S3
2. Client --> S3 --> Call Amazon EC2 to create thumbnail --> S3

First option will cost me bandwidth at my server. Second option will have a minimum cost of having a simple EC2 process (arnd $65 per month).

Does anyone have a better solution. Any pointers will be appreciated.

Re: 2 versions of and image

I didn't work with S3 yet, sorry but i can't help you in this case. I hope someone here in the forum can give you some good information about it.

Re: 2 versions of and image

masimao wrote:

I didn't work with S3 yet, sorry but i can't help you in this case. I hope someone here in the forum can give you some good information about it.

Thanks masimao. Me too am hoping that with my fingers crossed smile.

Re: 2 versions of and image

Exellent masimao, it works!
Many thanks!! smile
طراحی سایت