imagesource anomalies
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
imagesource anomalies
I have been playing around with the imagesource property of fields and there appear to be some anomalies.
The algorithm goes something like this:
set the imagesource of char x of field aField to the short id of an image
The image appears as expected.
put the htmltext of field aField into aVariable
set the htmlText of field aField to aVariable
Bomb. The image disappears.
When examining aVariable, the "img src" html reference does not appear.
On one occasion when the imagesource was set in this way, the htmltext of aField did in fact contain the html reference "img src". On this occasion, the image reproduced faithfully when the htmltext was passed in and out of aVariable.
Questions:
Why does the image appear if there is no html reference?
How do I ensure that the reference appears in the htmltext so that I can store and reproduce the image from a database application I have written?
I am writing medical software in which I want to be able to store and reproduce images inside patient notes in the appropriate places so gaining control over the imagesource property is quite important to me and this seemingly unpredictable behaviour is driving me crazy.
Any ideas?
Cheers
Alex
Brisbane, Australia
The algorithm goes something like this:
set the imagesource of char x of field aField to the short id of an image
The image appears as expected.
put the htmltext of field aField into aVariable
set the htmlText of field aField to aVariable
Bomb. The image disappears.
When examining aVariable, the "img src" html reference does not appear.
On one occasion when the imagesource was set in this way, the htmltext of aField did in fact contain the html reference "img src". On this occasion, the image reproduced faithfully when the htmltext was passed in and out of aVariable.
Questions:
Why does the image appear if there is no html reference?
How do I ensure that the reference appears in the htmltext so that I can store and reproduce the image from a database application I have written?
I am writing medical software in which I want to be able to store and reproduce images inside patient notes in the appropriate places so gaining control over the imagesource property is quite important to me and this seemingly unpredictable behaviour is driving me crazy.
Any ideas?
Cheers
Alex
Brisbane, Australia
Re: imagesource anomalies
Hi Alex,
please always note the version of LC that you are using.
There are currently a couple of different versions floating around
Best
Klaus
please always note the version of LC that you are using.
There are currently a couple of different versions floating around

Best
Klaus
Re: imagesource anomalies
Hi Alex,
I use imagesource quite a lot and have not seen what you describe.
What version of LC do you use? What operating system.
the htmlText lists the image source
Kind regards
Bernd
I use imagesource quite a lot and have not seen what you describe.
What version of LC do you use? What operating system.
the htmlText lists the image source
and setting the htmlText of a field as you did via a variable sets the imageSoure as it was before.<p>2	LavenderBlush4	Purple3	Maroon	DarkGray	Gray12	Honeydew2	<img src="12914" char="1">	RoyalBlue4</p>
Kind regards
Bernd
Re: imagesource anomalies
I managed a work around which is secure but doesn't explain the anomalous behaviour.
Instead of setting the imageSource property, I can replace the htmltext of the selectedChunk with <img src="imageName" char="o"> and it works!
I can now save the htmltext of the field to my database and provided I supply an image called "imageName" somewhere in the search hierarchy, the image appears exactly where I want it, safely. In my case the image is retrieved from an image table in the database and placed on a cloned image placeholder. Whoo hoo!
Alex
Brisbane, Australia
Instead of setting the imageSource property, I can replace the htmltext of the selectedChunk with <img src="imageName" char="o"> and it works!
I can now save the htmltext of the field to my database and provided I supply an image called "imageName" somewhere in the search hierarchy, the image appears exactly where I want it, safely. In my case the image is retrieved from an image table in the database and placed on a cloned image placeholder. Whoo hoo!
Alex
Brisbane, Australia
Re: imagesource anomalies
glad you got it working. On the other hand it would be good to know what happened.
At times resolving the short id of an image is kind of a guess work for LC especially if the image is not on the card or you create it on the fly.
Have a look at "resolve image" in the dictionary. That can be helpful to track this down.
But anyways, if it works for you this way then it works
Kind regards
Bernd
my guess is that you ran afoul of a missing ID, if the short id of an image can not be resolved it can not be shown.I managed a work around which is secure but doesn't explain the anomalous behaviour.
At times resolving the short id of an image is kind of a guess work for LC especially if the image is not on the card or you create it on the fly.
Have a look at "resolve image" in the dictionary. That can be helpful to track this down.
But anyways, if it works for you this way then it works

Kind regards
Bernd
Re: imagesource anomalies
Hi Bernd and Klaus
Thanks so much for your helpful replies. I shall explore "resolve image" a bit further.
I have experimented with two LC's - 7.1.0 Community (Build 10043) and LC 8.0.0-dp-4 (Build 13002). Both crash reasonably regularly in El Capitan, predictably when not making a selection in a menu, and unpredictably on occasion as well. The problem with the imagesource is identical with both versions.
As an aside, I am not particularly enamoured of some of the changes to the IDE in 8 - I don't like the new directory and the inspector windows often extend beyond the vertical limits of my 11 inch MacAir laptop which is my companion in all things. What do others think?
I have to say despite some issues - lack of true OOP for example - it is such a joy to use my Livecode application in my daily work. Medicine is information intensive - the smart doctors now and in the future will be focussed more on how to find information rather than having to remember everything as in the past. It was the bane of my life for the past thirty years, the grind of trying to remember everything and now this information is at my fingertips in a form which is intuitive (for me) and which speeds my note-taking by 30-50% as well as improving accuracy and safety. Such fun.
Cheers
Alex
Brisbane, Australia
Thanks so much for your helpful replies. I shall explore "resolve image" a bit further.
I have experimented with two LC's - 7.1.0 Community (Build 10043) and LC 8.0.0-dp-4 (Build 13002). Both crash reasonably regularly in El Capitan, predictably when not making a selection in a menu, and unpredictably on occasion as well. The problem with the imagesource is identical with both versions.
As an aside, I am not particularly enamoured of some of the changes to the IDE in 8 - I don't like the new directory and the inspector windows often extend beyond the vertical limits of my 11 inch MacAir laptop which is my companion in all things. What do others think?
I have to say despite some issues - lack of true OOP for example - it is such a joy to use my Livecode application in my daily work. Medicine is information intensive - the smart doctors now and in the future will be focussed more on how to find information rather than having to remember everything as in the past. It was the bane of my life for the past thirty years, the grind of trying to remember everything and now this information is at my fingertips in a form which is intuitive (for me) and which speeds my note-taking by 30-50% as well as improving accuracy and safety. Such fun.
Cheers
Alex
Brisbane, Australia
Re: imagesource anomalies
Hi Bernd and Klaus
Using "resolve image" after using "imagesource" the graphic appears to solve the problem - thank you. However, having found a reliable solution I am going to stay with it as I can manipulate the htmltext more easily for storage and retrieval of the images.
Cheers
Alex
Using "resolve image" after using "imagesource" the graphic appears to solve the problem - thank you. However, having found a reliable solution I am going to stay with it as I can manipulate the htmltext more easily for storage and retrieval of the images.
Cheers
Alex
Re: imagesource anomalies
Hi Alex,
But the main focus at present regarding the IDE is restructuring and modularizing things like the Properties Inspector. Once that is done it will be a lot easier to change aspects of it. (for the LC team and the community)
There has been a long debate on the use-list about this. A lot of people seem unhappy.
http://runtime-revolution.278305.n4.nab ... 97028.html
I feel that LC 8 has its teething problems but what is happening on the outside (widgets) and the inside (modularizing the IDE) looks very promising.
Kind regards
Bernd
I consider the LC8 series a work in progress, especially the properties inspector is missing quite some things and the design is by no means final.As an aside, I am not particularly enamoured of some of the changes to the IDE in 8
But the main focus at present regarding the IDE is restructuring and modularizing things like the Properties Inspector. Once that is done it will be a lot easier to change aspects of it. (for the LC team and the community)
There has been a long debate on the use-list about this. A lot of people seem unhappy.
http://runtime-revolution.278305.n4.nab ... 97028.html
I feel that LC 8 has its teething problems but what is happening on the outside (widgets) and the inside (modularizing the IDE) looks very promising.
Kind regards
Bernd
Re: imagesource anomalies
Hi Bernd
I haven't written LC8 off - the interface is in some respects cleaner and quicker but I am sticking with LC7 for my programming for the present. Except for the crashes in El Capitan, it is reliable and familiar.
Cheers
Alex
I haven't written LC8 off - the interface is in some respects cleaner and quicker but I am sticking with LC7 for my programming for the present. Except for the crashes in El Capitan, it is reliable and familiar.
Cheers
Alex