Loading images from a non-URL source

Björnke von Gierke bvg at mac.com
Wed Jul 21 13:16:00 EDT 2004


this works for me:

on mouseUp
   answer file ""
   if the result = "" then
     set the data of me to URL ("binfile:" & it)
     put the Data of me into image 1
   end if
end mouseUp

On Jul 21 2004, at 15:25, Frank D. Engel, Jr. wrote:

> So then something like this attached to a button should work?  It 
> doesn't seem to.  I select a JPEG image file (I tried several 
> different ones).
>
> on mouseUp
>   answer file "Select an image file:" as sheet
>   put it into x
>   if there is a file x then
>     open file x
>     read from file x until EOF
>     put it into y
>     close file x
>     set the text of image "Logo" to y
>   end if
> end mouseUp
>
> If I  set the filename of image "Logo" to x, then the image appears, 
> but I need to be able to take the data from a database field (and to 
> take image data from a file and store it in the field), so I need 
> functionality similar to the above.
>
> What am I missing here?
>
>
>
> On Jul 20, 2004, at 18:00, Jeanne A. E. DeVoto wrote:
>
>> At 10:51 PM +0200 7/20/2004, Klaus Major wrote:
>>> Hi Frank,
>>>
>>>> How can I take binary image data stored in a variable (obtained 
>>>> programmatically,
>>>> usually from a database query) and display it in an image field 
>>>> without first storing
>>>> it to a file?  I can't seem to find any information on this.
>>>>
>>>> I tried this, but it doesn't seem to work:
>>>>
>>>> set the fileName of image "Logo" to empty
>>>> set the imageData of image "Logo" to an_obtained_value
>>>
>>> when using "the imagedata" you have to make sure that the "target" 
>>> image has EXACTLY
>>> the same dimensions as the "source" image, or you might expereince 
>>> ugly results...
>>>
>>> But you can:
>>>
>>> ...
>>> put a_var_with_binary_data into img 1
>>> ...
>>>
>>> and it will resize to the correct dimensions :-)
>>
>> It's also important to know that imageData and the content of an 
>> image (its text property) aren't in the same format.
>>
>> The imageData is an invariant format that provides the RGB data for 
>> each pixel. The text of the image is the image's data in whatever 
>> format - PNG, GIF, JPEG, or whatever format the image is encoded in.
>>
>> Normally, if you get the data from some other source, it will be in 
>> PNG, GIF, etc., so you'll use a statement like
>>   put myImageData into image "My Image"
>> Only if you're modifying the image data yourself do you use the 
>> imageData, usually.
>> -- 
>> jeanne a. e. devoto ~ revolution at jaedworks.com
>> http://www.jaedworks.com
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
>
>
> ________________________________________________________________
> $0 Web Hosting with up to 120MB web space, 1000 MB Data Transfer
> 10 Personalized POP and Web E-mail Accounts, and much more.
> Get It Now At www.doteasy.com
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list