I'm trying to display a picture as mouseover text with vision.
I figured out using a bit of HTML code such as <html><img src='file://localhost//C://1.jpg'/> works fine.
Hoewever, now I want to view a picture from the image management.
As far as my knowledge goes these are stored in the internal db so I don't have a location path which I can use.
Is there any way to get around this in order to display an image from image management as mouseover text?
The images in image management are actually automatically hosted by the gateway webserver. You just use the path to the gateway, followed by /system/images/$yourImage.
I've been experimenting with this, and it took me a while to figure this out using built in icons.
I used this to find the gateway address: print system.util.getGatewayAddress() and it returned: http://localhost:8088,
so naturally, taking the original working code from @Corne_de_Jonge combined with @PGriffith's suggestion, I tried: <html><img src='file:http://localhost:8088/system/images/Builtin/icons/24/check2.png'/>, but that does not work!
file has to be changed to url, so the final and working code looks like this: <html><img src='url:http://localhost:8088/system/images/Builtin/icons/24/check2.png'/> The preceding code on a button's Mouseover Text property produces this result:
However, I'm applying this to a project in which there are a couple of dozen pictures which need to be flipped. It would be a real time saver and neater if we could get this working with a bit of HTML code.
Unfortunately, as I understand it, Vision uses an antiquated version of HTML that offers very little in the way CSS style abilities. There is no "built in" way that I am aware of that can flip the image in the mouseover text.
On that note, I developed a script that will accomplish what you are wanting to do. It reads the stock image, flips it programmatically, and subsequently saves it to the client's cache file. Then, it assigns the html path for the newly created file to the designated mouseover text property.
Here is the result:
Here is the script:
from java.awt.image import BufferedImage
from javax.imageio import ImageIO
from java.net import URL
import getpass
username = getpass.getuser()
path = "C:/Users/" + username + "/.ignition/cache/"
url = URL("http://localhost:8088/system/images/Builtin/icons/24/check2.png")
image = ImageIO.read(url)
flipped = BufferedImage(image.getWidth(), image.getHeight(), image.getType())
for x in range(image.getWidth()):
for y in range(image.getHeight()):
flipped.setRGB(x, image.getHeight() - y - 1, image.getRGB(x, y))
ImageIO.write(flipped, "png", open(path + "flipped.png", "wb"))
event.source.toolTipText = "<html><img src='file:///" + path + "flipped.png'>"
It's a shame that it has to be so complicated due to lack of CSS style abilities, but if we can get it working with this would be great.
Going to test it soon, will let you know if it works for me too.
UPDATE: We decided to leave it as it is, since we began working on a transition to Perspective.