Page 1 of 1

Upload JPEG

Posted: Fri Apr 09, 2010 12:44 pm
by bsouthuk
Hello Rev users!

I've built an application in Studio and I want a user to be able to upload a Jpeg or bitmap image to a card. Is this simply done?

Your help is as always, much appreciated.

Cheers

Daniel

Re: Upload JPEG

Posted: Fri Apr 09, 2010 3:33 pm
by Mark
Hi daniel,

This is easy to do, but you can't save the changes in a standalone. There are several ways to do this.

1) Create a new image object and set the filename of the image object to the path to your file
2) Create a new image object and set the text of the image object to the contents of your file
3) Use the import paint command

You can do all this by script.

Best,

Mark

Re: Upload JPEG

Posted: Fri Apr 09, 2010 3:44 pm
by jmburnod
Hi Daniel

You can use this script

Code: Select all

on mouseup
   ImportPicture
end mouseup

on ImportPicture
   answer file "Choose an image" 
   if it = empty then
      exit ImportPicture
   end if
   put it into TheFile
   import paint from file TheFile
end ImportPicture
Best

Jean-Marc

Re: Upload JPEG

Posted: Fri Apr 09, 2010 4:22 pm
by bsouthuk
Thats excellent thank you so so much for the script.

What script would I need to delete/clear the images that have been uploaded?

Cheers

dan

Re: Upload JPEG

Posted: Sat Apr 10, 2010 8:58 am
by jmburnod
Daniel,


If the script import the imagefile by "import"

Code: Select all

on ImportPicture
   answer file "Choose an image"
   if it = empty then
      exit ImportPicture
   end if
   put it into TheFile
   import paint from file TheFile
end ImportPicture
you can delete the last img

Code: Select all

delete last img
If the script use the filename (an image "MyImage" exists on the card)

Code: Select all

on ImportPicture
   answer file "Choose an image"
   if it = empty then
      exit ImportPicture
   end if
   put it into TheFile
   set the filename of img "MyImage" to TheFile
end ImportPicture
You can clearing the image

Code: Select all

set the filename of img "myImage" to empty
Best

Jean-Marc