Loading and displaying image

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Josh
Posts: 46
Joined: Sat Jan 12, 2008 6:42 am

Loading and displaying image

Post by Josh » Mon Jul 12, 2010 4:34 am

Hi all,

It's been a while since I've needed help, but you guys are incredible. Here's my dilemma (and I did search for the solution first, but to no avail). I have an experiment where I need to load and display .gif files. There will be different version of this, but I will usually display 2 or 4 and the participant will choose 1 (of 2) or rank the 4 in a particular order. What I can't figure out is how to get the card to load and display the .gif file. I've tried a bunch of methods like:

get URL "binfile:/P1D16C2.gif"
put URL "binfile:/P1D16C2.gif" into image "pic1"
show pic1

as a start (obviously I'll need to tweak size and location). But I can't even get the file to load and display. If anyone can help, I'd immensely appreciate it. FWIW, I will be keeping all the files in the same folder/directory as the program, so identifying the location is a non-issue.

Thanks again,
Josh

Josh
Posts: 46
Joined: Sat Jan 12, 2008 6:42 am

Re: Loading and displaying image (progress, but still stuck)

Post by Josh » Mon Jul 12, 2010 4:48 am

Update:

This works for loading and displaying the image:

import paint from file "P1D16C2.gif"

However, it's huge and seems to be a card all by itself. I need it to be smaller and displayed on the same card as another gif file.

Thanks,
Josh

Curry
Posts: 111
Joined: Mon Oct 15, 2007 11:34 pm
Contact:

Re: Loading and displaying image

Post by Curry » Mon Jul 12, 2010 5:25 am

Try setting the filename of your image.
Best wishes,

Curry Kenworthy

LiveCode Development, Training & Consulting
http://livecodeconsulting.com/

WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/

Josh
Posts: 46
Joined: Sat Jan 12, 2008 6:42 am

Re: Loading and displaying image

Post by Josh » Mon Jul 12, 2010 8:38 am

Okay,

It's probably overly cumbersome and clunky, but on the bright side, I'll know exactly what it'll look like.

Here is my "solution" for posterity:

1. Object-->New Control-->Image
2. Size image as I want.
3. Insert image into image control
4. Ensure ration and appearance is good
5. Repeat for the rest of images
6. Hide and display images as code specifies

It'll take some extra time, but I think it's my best bet as I do want to ensure appropriate ratios and appearances.

Feel free to post additional thoughts, but I'm good now. Thanks all for being here (and Curry for your reply!).

Rauterkus
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 33
Joined: Fri Apr 14, 2006 8:12 pm
Contact:

Re: Loading and displaying image

Post by Rauterkus » Mon May 27, 2013 12:48 am

How do you do make a new image from a button:

Mentioned above in the thread as:
Object-->New Control-->Image

This does not work.

On MouseUp
create control image
End MouseUp

???

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Loading and displaying image

Post by sturgis » Mon May 27, 2013 12:55 am

try:

Code: Select all

create image "whateveryouwanttonametheimage"

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Loading and displaying image

Post by BvG » Mon May 27, 2013 7:52 am

you also have to set lockLoc to true for all images where you set the rectangle, width, height, or any other geometry-type property besides locations. This is because by default, images will resize to their "default", unless you do set lockLoc.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply