Setting image source of fld char to remote URL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Setting image source of fld char to remote URL

J. Landman Gay via use-livecode
Our new heifer, Kali is a "doll"

http://www.himalayanacademy.com/blog/wp-content/uploads/2017/07/kali-the-calf/kali-real-close.JPG

playing around with a silly brainstorm… "in app blog thingy"

on mouseUp
set the imageSource of last char of fld "app-news" to "http://www.himalayanacademy.com/blog/wp-content/uploads/2017/07/kali-the-calf/kali-real-close.JPG"
end mouseUp


does nothing.. but , create an image, set loc -3000 get It's ID  and this does work

on mouseUp
set the filename of img "app-news-img-1" to "http://www.himalayanacademy.com/blog/wp-content/uploads/2017/07/kali-the-calf/kali-real-close.JPG"
set the imageSource of last char of fld "app-news" to 1005
end mouseUp

needs some rect math on the image size to fit (wish we had engine level resize image-preserve-ratio pWidth, pHeight, different subject)

OR

I am working too hard and will probably just use the browser widget

BUT

I think there are contexts/use cases for  having remote images appear in line in fields

this also doesn't work

create field "news-html"

fill with

<p> Welcome to Planet Earth, Kali!</p>
<img src="http://www.himalayanacademy.com/blog/wp-content/uploads/2017/07/kali-the-calf/kali-real-close.JPG" /"
<p>What a gift!</p>


on mouseUp
set the htmltext of fld "app-news" to fld "news-html"
end mouseUp

we get

Welcome to Planet Earth, Kali
What a gift!

but no image.

am I missing anything or is this all just as expected: what we get…

BR

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Setting image source of fld char to remote URL

J. Landman Gay via use-livecode
Browser widget:
Use a HTML-file and set the URL of the widget to that file.
Setting the htmltext alone in order to get an image from a server
usually doesn't work (what is the same with all browsers, this is
not LC-special). If you wish to work with the image, you may have
to respect the same-origin-policy.

Imagesource:
To display an image from URL <imageURL> (on a server) in a field,
for example at size 80x60 at char 42:
1. create invisible img "i1"
2. set the filename of img "i1" to <imageURL>
[You can access by that the formattedWidth and formattedHeight].
3. set the width of img "i1" to 80; set the height of img "i1" to 60
4. set the imagesource of char 42 of fld 1 to "i1"

There are also examples in "Sample stacks" for using javascript and
canvas2d. But this gives, TMHO, no advantage advantage here, only
increases datasize by 30% by using base64.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Setting image source of fld char to remote URL

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
Of course you can get the display in a browser widget by
setting the htmltext alone if you give the image source
_directly_ (as part of the htmltext) as base64 encoded data.

<img src="data:image/jpeg;charset=utf-8;base64,<encodedData>" />"
[After LC-base64-encode replace linefeed with empty in the data.]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...