Web Browser Scaling?


#1

Looking to display images from a website. Storing the complete image link in a DB field, and referencing that field in the Web Browser Object. Works great! Images are way big, though, and I don’t see any way to scale, like we have in image objects. As I think about this, I will probably want some other record text on the page with the image, so will probably change methods to html. So, is it possible to get an auto scale, like the image object offers, with the img tag? Or is there a better way to do this. Thanks!


#2

If you have the Web Browser object set to formula, you can use something like this to re-scale the image:

{<!DOCTYPE html>
<img src="}+Images+{" width="80%">
</html>}

This would load the image from the web at the current address in the Images field and scale it to 80%. You only use either the width or the height and the other will scale proportionately. You can also use a value instead of a percentage and it will work the same way. You could possibly create a much more robust formula that would check the dimensions of the image and scale it to fit the Web Browser dimensions but it would be pretty complicated to pull off.:grimacing:


#3

Does/will Web Browser Object support CSS styles?


#4

Yes, certainly. It should support anything that Safari supports.

The Panorama Help wizard uses the Web Browser object, and the help pages make heavy use of CSS styles.


#5

Terrific. I’m pretty sure I’ll be able to get the scaling I’m looking for with styles, but didn’t want to re-visit all that stuff if it weren’t supported. Thanks!


Web Browser and Stylesheets
#6

OK. I can’t seem to get CSS internal stylesheet method to work, although inline styles seem to. I’m using TacoHTML to proof code. It checks out syntax as ok, and previews with Safari perfectly, but will not display in WB object.
!!!
Can’t figure out how to display code here but it works fine in Safari, and TacoHTML, but won’t render in PanX WB Object. If I remove everything in the tag, it works, but the image is way too big. Inline style tags also work, but are too cumbersome for this effort. Does anyone have a sample of a stylesheet that works in the WBO?


#7

I have verified that CSS internal stylesheets don’t work in Panorama X, and I have filed a bug report. However, I don’t think there is much I can do about this other than report it to Apple and hope that they fix it in a future version of macOS. Since it works in Safari, I would certainly be hopeful that they would fix it in the version of WebKit included in macOS.


#8

Thanks, Jim. I’ll go with external sheets until they wake up. :wink:


#9

Actually, external sheets are no trip to the park, either. :slight_smile: I have a very simple ESS saved in the same folder as the database. Code that works in TacoHTML, and displays properly in Safari, seems to be ignored in the WBO. It doesn’t lock up completely, as it does with internal style sheets (when you have something in the Style tag, inside the Head tag). The image links update as you scroll through records, but no formatting is applied. (??)


#10

I had no idea what TacoHTML was, and I imagine most readers on this forum don’t either. I did a google search and found that it is a defunct HTML editing app. It appears that Taco Software shut down at least 2 years ago.

External CSS style sheets definitely work. Every Panorama X help page uses an external style sheet. Here is the header used in the help pages, the styles are in a file called styles.css in the same folder as the html files.

<head>
<meta charset="utf-8"/>
<title>Table of Contents</title><link rel="stylesheet" href="styles.css"><link rel="stylesheet" media="print" href="print.css"/><link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
</head>

It could be that external style sheets don’t work if you are not displaying an actual HTML file. Or, you might need to code the full link to the style sheet file, instead of relying on a relative link.


#11

OK.
As you’ve pointed out, TacoHTML is just a HTML editor. I use it to eliminate html syntax errors. It has a number of very useful features, including the ability to preview results in various browsers. All in all, a very useful tool for occasional coders. Not surprised it’s defunct, as the free software model is tough to sustain. I think I was first introduced to it through the old Pan list, and have used it ever since. I cited it in this post to help assure readers that the html was solid, and displayed correctly in Safari (and I couldn’t remember how to include code in the post :).
Regarding the external css file - the relative link worked in the html editor, and Safari, as well. Since relative links worked most other places in PanX, that’s what I went with. That didn’t work.
Turns out the full link didn’t work at first either, but that was because the path contained an upper-ascii character in the name of one of the folders. Since I converted that, all is well!
So, external style sheets do work in the Web Browser Object, but require a full clean path. (there’s probably a function to convert funky characters, too)


#12

I find the surest way to get correct paths into a procedure or one of the properties panes is to simply drag the file or folder directly from the Finder into the formula or procedure and drop it there. The full path will automatically be entered into the code area.