NetTalk Central

Author Topic: Embeds for image processing  (Read 5629 times)

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Embeds for image processing
« on: January 24, 2012, 08:19:09 PM »
I'm still a full version of NTWS behind, but having jumped to v.5, can anyone offer guidance on these questions:

1. Where is the best place (both proc and embed point) to resize an uploaded image. I could use ClarionFreeImage, but I happen to be using ImageEx3 (I don't think it matters particularly). But I'm having embed point troubles.

2. In using the webhandler to rename the file to include the date and time stamp, where is the first embed point that I can grab the name assigned by the webhandler proc?

3. If a user deletes the record, where is the best embed to first grab the image file pathname from my update procedure, and delete the image files before the record itself is deleted?

Thanks for any insights.

Mike Grigsby
Credify Systems
Mike Grigsby
Credify Systems
Central Oregon, USA

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Embeds for image processing
« Reply #1 on: January 24, 2012, 08:47:15 PM »
I use FreeImage and I use the post insert embed in my form for inserting images.

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

NetTalk 12.55
Clarion 11

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Embeds for image processing
« Reply #2 on: January 24, 2012, 09:23:10 PM »
Pt 1 & 2 check out the upload file example. The example shows how to rename the file and after that, run your re-size program.

Pt 3 - Try Validate delete or PostDelete

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Embeds for image processing
« Reply #3 on: January 31, 2012, 08:30:40 AM »
I'm still struggling a bit with where to put the image processing. I'm using ImageEx3 and can't find an embed where it works. I'm trying to upload an image, then, before the form is finished, resize it to something like 640x480 so the size is managed in the system, rather than by the user.

So the upload is working okay, but I've got the code in the Post Update embed. It acts like it is unloading the ImageEx code before it does the thumbnail. I can get the ImageEx to do a thumbnail conversion on an existing file in the folder, at a prior embed point. So I know ImageEx is working. I can even see where the WebHandler is uploading and putting the image in the folder, but I think I'm just missing the ideal embed point between the two. Any ideas? Thanks all.

Mike Grigsby
Credify Systems
Mike Grigsby
Credify Systems
Central Oregon, USA

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Embeds for image processing
« Reply #4 on: January 31, 2012, 08:40:18 AM »
Post Update is used for updating the record - ie., changing a record that already exists

Post Insert is used during the insertion of the record.  This is where I process my images.  

Let me see if I can throw together an example app.  Although, I'm using FreeImage.....

Don  

EXAMPLE ATTACHED.....

[attachment deleted by admin]
« Last Edit: January 31, 2012, 08:45:23 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Embeds for image processing
« Reply #5 on: January 31, 2012, 03:13:00 PM »
try running your image program from within the webhandler after you have renamed your file.

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Embeds for image processing
« Reply #6 on: January 31, 2012, 07:14:42 PM »
Don, actually, the testing was on a record being updated/changed. Can you tell me which embed you make your call to the Clarion Free Image?

Kevin, I originally tried adding the thumbnail call to the WebHandler, but I don't think the image was actually in the upload until later. Though I'm not sure if WebHandler does the upload before or after the form is completed, where the file is specified. It seemed like it was too early to do any thumbnailing.
Mike Grigsby
Credify Systems
Central Oregon, USA

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Embeds for image processing
« Reply #7 on: January 31, 2012, 08:16:58 PM »
Don, actually, the testing was on a record being updated/changed. Can you tell me which embed you make your call to the Clarion Free Image?

I use post insert.  You could use post update for changes.

Check out my example.  I'll bet there's less than 10 lines of code in the whole app that deal with image processing.

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

NetTalk 12.55
Clarion 11

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Embeds for image processing
« Reply #8 on: January 31, 2012, 09:44:42 PM »
If you wanted to do in the webhandler, this is where I would do it. I have some long running process's after files have been uploaded so I set a SSV here so I know the filename and then process on a separate Thread.

ThisNetWorker.HandleFile PROCEDURE(STRING p_name,STRING p_filename,*STRING p_file,LONG p_len)

ReturnValue          ANY

! Start of "NetTalk Method Data Section"
! [Priority 5000]

! End of "NetTalk Method Data Section"

  CODE
  ! Start of "NetTalk Method Executable Code Section"
  ! [Priority 2500]

  ! Parent Call
  ReturnValue = PARENT.HandleFile(p_name,p_filename,p_file,p_len)