Displaying an Image on Web

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Displaying an Image on Web

Post by endernafi » Fri Aug 24, 2012 1:42 pm

Hi there dear LiveCoders,

I'm coding a tiny news application.
Actually, it's almost done.
Unfortunately, I cannot show the image of related news in its corresponding area.
set the filename of image "myImage" to myUrl doesn't work, naturally :D
Images are on the web and I don't want to download them into a temp directory.
And I can't use browser controls because there are hundreds of news.
I don't know how to deal hundreds of iOS controls, I don't want to either.
Is there a way to do this, like

Code: Select all

set the imageUrl of image "myImage" to "http://www.example.com/myimage.jpg"
Or do I have to download them first into a temp folder, then set their filenames to the local images?


Regards,

~ Ender Nafi Elekcioglu
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an Image on Web

Post by Klaus » Fri Aug 24, 2012 2:26 pm

Hi Ender,
set the filename of image "myImage" to myUrl
doesn't work, naturally
well, but that's the correct and official syntax! :D

According to the dictionary this should also work on iOS.
Did you try it? Maybe it takes while, but should work!


Best

Klaus

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Displaying an Image on Web

Post by endernafi » Fri Aug 24, 2012 2:44 pm

Yes, it works :oops:
It's taking too long but it loads all the images.
I've imagined that it can't load therefore freezes my app.
It waits on splash screen to load them.
Now, I have to think a workaround against this waiting issue.
Any quick idea?

By the way, thanks so much Klaus,


Regards,

~ Ender Nafi Elekcioglu
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an Image on Web

Post by Klaus » Fri Aug 24, 2012 3:44 pm

Hi Ender,

well, loading stuff from the net in the splash screen/appstart is a bad idea! 8)

I would displasy a static image in the splash screen and then load the images AFTER the splash screen disappeared.
Maybe you could really "load" the images first, which is non blocking, and then set their filename to the files on disk
or to the cached url, where the latter is of course not persistent.

Maybe you could first check if you already downloaded one or more of the images before loading again.

Check "load" in the dictionary, you can define a "callback" message that is send when the download has finished.
Please try this and come back with specific questions.


Best

Klaus

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Displaying an Image on Web

Post by endernafi » Fri Aug 24, 2012 4:28 pm

Thanks, I'll try.
I'm also thinking a server-side solution.
A php code which will produce a 4kb thumbnail image of ~100 kb actual image,
right after when the client enters the actual image url in the app's admin panel on web.
The admin panel is only to enter the news' into database, btw.

Well, the image area of each news is 50px*50px.
There is no need to load actual big image, right?

I think your advice and my solution combined is gonna work :wink:
Thanks again...


Regards,

~ Ender Nafi Elekcioglu
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an Image on Web

Post by Klaus » Fri Aug 24, 2012 4:55 pm

Hi Ender,

yep, the rule of thumb is to have images on the net in the same size as they are displayed.
That is the most efficient way, even in the days of high-speed DSL 8)

May I ask where you are from?
Your name sounds a bit turkish to me :)


Best

Klaus

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Contact:

Re: Displaying an Image on Web

Post by endernafi » Fri Aug 24, 2012 5:02 pm

Yes, I'm Turkish, I live in Istanbul;
und ich glaub' du bist Deutsch, richtig? :wink:
Twenty years ago I've studied Deutsch for 2 years, that's what's left ha ha :D


Best regards,

~ Ender Nafi Elekcioglu
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Displaying an Image on Web

Post by Klaus » Fri Aug 24, 2012 6:05 pm

Merhaba Ender,

ja, ich bin deutsch :D


Best

Klaus

Post Reply