NetTalk Central

Author Topic: upload and resize image  (Read 9740 times)

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
upload and resize image
« on: April 12, 2011, 12:51:05 PM »
hello please can anyone help trying to make it possible for a user to upload a file but get it resize before saving it in a folder on the system

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: upload and resize image
« Reply #1 on: April 12, 2011, 06:38:29 PM »
I'm not sure what you mean.
How do you resize a file?

Cheers
Bruce

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: upload and resize image
« Reply #2 on: April 12, 2011, 07:21:29 PM »
Unfortunately on the web, unless you use some client side code (java app or clarion app) you'll have to let the client upload the larger file and then resize at the server.

You'll need a library that can resize images (Like ImageEx or LeadTools).

On the form that contains the image. Add code into the POSTUPDATE.Start embed.

The image should be in the upload folder at this time, grab it resize it and put it in the right place.

I also have code in the RenameFile embed point (in the WebServerHandler procedure) to name the incoming files in a way i like.

Regards
Bill




Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: upload and resize image
« Reply #3 on: April 12, 2011, 08:34:31 PM »
ahh - resizing _image_ files... that makes sense.
see also http://www.clarionfreeimage.com/

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: upload and resize image
« Reply #4 on: April 13, 2011, 01:48:27 PM »
thanks that almost work using clarionfreeimage to resize the images but my problem now is capturing the file uploaded name , i can make it work if i have a pre-defined names but the names of the files are going to be random and i will have to upload four diffrent image file upto the form.so need to get each file and then resize them has they are uploaded.

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: upload and resize image
« Reply #5 on: April 13, 2011, 04:42:54 PM »
The filename should be in the value of the field you used for the file upload.

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: upload and resize image
« Reply #6 on: April 14, 2011, 05:54:48 AM »
Thanks guys that worked. Got it to resize the file and renamed it but got just one little problem to go.
Now that i have created my new file how do i update the filed path name and file name to point to my new filename and not still holding my old copied file, try to rename it at renamefile procedure but the problem with this is that it renames the file to the new name before i can use clarionfreeimage to resize the image file.

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: upload and resize image
« Reply #7 on: November 18, 2011, 06:10:18 PM »
Has anyone got something like this to work?

I want my user to be able to:

1.  Upload an image..could be BM,JPG,PNG,etc..

2.  Once the file is uploaded into the uploads directory,
     resize the image file on the disk =< 50k

Thanks,

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: upload and resize image
« Reply #8 on: November 18, 2011, 06:34:06 PM »
Hey Folks,

The way I've worked this is:

- upload image
- extract image name
- copy image from uploads path to custom path
- create the various image sizes needed (eg HiRes - which is usually the one uploaded, LowRes, Thumb)
  - this is done using Draw + FreeImage
- update the record fields (HiresPath, Lowres_Path, Thumb_Path)

Works pretty well. The system deals with a lot of images and this paradigm has been in place for a year now, hasn't skipped a beat.
Cheers,

Stu Andrews

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: upload and resize image
« Reply #9 on: November 19, 2011, 08:28:57 AM »
Okay Stu, this part:

- create the various image sizes needed (eg HiRes - which is usually the one uploaded, LowRes, Thumb)
  - this is done using Draw + FreeImage

Can you get me pointed in the right direction as to how to do this?

Thanks!

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: upload and resize image
« Reply #10 on: November 19, 2011, 03:50:52 PM »
Hey Stu,

With a great deal of help from Larry Sand....I have it working now.

Thank you my friend!

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: upload and resize image
« Reply #11 on: November 20, 2011, 02:16:27 PM »
Great to hear you got it working Don. Apologies for not getting back on the forum till (my) monday morning. My weekends are full of Family and Church stuff :)
Cheers,

Stu Andrews

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: upload and resize image
« Reply #12 on: November 20, 2011, 02:59:49 PM »
It turned out to be pretty darn simple.  What I'm doing is simple but I just didn't have a clue how to do it.

I'm going to zip up the example app and provide here in the Share Knowledge section.

Very understandable you being busy Stu.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: upload and resize image
« Reply #13 on: November 29, 2011, 12:35:05 AM »
I have been doing this for some time, using the ImageEx system (v.2). Recently, I changed how I am doing it though. I'm now using a separate program to do the image processing in a queue because I found it was bogging down the system to have multiple instances of ImageEx running on a larger scale system with multiple clients hammering away with image uploads.
Mike Grigsby
Credify Systems
Central Oregon, USA

dcpeders

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: upload and resize image
« Reply #14 on: November 29, 2011, 08:58:48 AM »
Mike,

Care to share what program you are using for the images?

Thanks,

Dave Pederson