Uploading an image

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
garry_sonicdc
Posts: 3
Joined: Sun Mar 29, 2015 8:26 pm

Uploading an image

Post by garry_sonicdc » Tue Apr 28, 2015 11:25 pm

Hi everyone, I'm still fairly new to LiveCode so I'm struggling to know how to explain my problem correctly, but here it goes...

I'm building an Invoice Creator program for Windows, you input the data for your invoice into fields on a card and then click a button which creates a PDF of the invoice. That all works fine.

What I want to provide is an option for the end user to upload an image which can replace the default image that is on the final invoice PDF. Basically giving them the option to have there own logo on their invoices.

Is this even possible? I'm not entirely sure what I would search for to get some help, hence why I've resorted to posting in here.

Either an actual solution or a nudge in the right direction would be of great help!

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: Uploading an image

Post by sefrojones » Wed Apr 29, 2015 1:41 am

Try this out:

Create a new stack with a button and an image area.

In the button put this script:

Code: Select all

on mouseUp
   answer file "select an image"
   put it into tPicPath
   set the filename of img 1 to tPicPath
end mouseUp

Hope this helps.

--Sefro

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Uploading an image

Post by dave.kilroy » Wed Apr 29, 2015 8:39 am

Hi Garry - you wrote "upload an image" - do you want to upload it to a server or use in your app? Both are very doable and Sefro showed one way to do the latter, uploading to the server takes more work...

Kind regards

Dave
"...this is not the code you are looking for..."

garry_sonicdc
Posts: 3
Joined: Sun Mar 29, 2015 8:26 pm

Re: Uploading an image

Post by garry_sonicdc » Mon May 04, 2015 6:58 pm

Thanks Sefro,

This has worked perfectly!

Thanks to Dave too, not quite ready to be using servers just yet though!

Post Reply

Return to “Talking LiveCode”