[SCRIPT] HTML Image Preview

Discuss and share scripts and script files...
klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: [SCRIPT] HTML Image Preview

Post by klownboy »

TheQwerty wrote:Not possible.
Oh well, thanks TheQwerty. No chance for executing the Windows default action either I assume?

In the change log you mention, "◦Adds global for calling scripts to specify images." Does that mean I should be able to specify a global for "$G_FILTERS = *.gif" to only show gif files in a calling script . I ask because previously I was specifying "perm $P_THEQWERTY_HTML_IMAGE_PREVIEW__FILTERS = *.gif" in the CTB left click button and "*.jpg" for the right-click before the load statement.
Thanks
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [SCRIPT] HTML Image Preview

Post by TheQwerty »

New release in the first post...
Change Log
  • v2.0 - 2015-03-31 15:00z
    • Adds global for overriding filter configuration.
    • Separates showing preview from the action taken on selected images.
    • Adds scripts for various actions.
    • Changes default action to showing a menu. To get the old behavior use the select script:

      Code: Select all

      Load 'HTMLImagePreview', 'select', 'f';
    • Changes menu order and access keys.
------------------

klownboy wrote:
TheQwerty wrote:Not possible.
Oh well, thanks TheQwerty. No chance for executing the Windows default action either I assume?
Not from the preview window but with v2.0 the showing of previews has been separated from the action taken on the selected items. So you can now do something like:

Code: Select all

"Open Images"
  Load 'HTMLImagePreview', 'showPreview', 'f';
  Global $G_RESULTS;

  if ($G_RESULTS != '') {
    $app = 'C:\Path\To\Program.exe';
    OpenWith $app, 's', $G_RESULTS;
  }
klownboy wrote:In the change log you mention, "◦Adds global for calling scripts to specify images." Does that mean I should be able to specify a global for "$G_FILTERS = *.gif" to only show gif files in a calling script .
No.. it meant you could set the global $G_IMAGES to a list of images to display in the preview and the script would show those images without applying any filtering.

As of v2.0 there's also the possibility to override the configured filters by setting the global variable $G_FILTERS_OVERRIDE.

Code: Select all

"Show JPGs, GIFs, and PNGs in Images Paper Folder"
  Global $G_IMAGES = FormatList(PaperFolder('Images',,<crlf>,'r'), 'fdents', <crlf>, "*.jpg<crlf>*.gif<crlf>*.png");
  Load 'HTMLImagePreview', 'showPreview', 'f';

"HTML Image Preview: Select from GIFs"
  Global $G_FILTERS_OVERRIDE = '*.gif';
  Load 'HTMLImagePreview', 'select', 'f';

"HTML Image Preview: Archive PNGs & JPGs"
  Global $G_FILTERS_OVERRIDE = '*.png;*.jpg';
  Load 'HTMLImagePreview', 'archive', 'f';

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: [SCRIPT] HTML Image Preview

Post by klownboy »

Thanks TheQwerty for both the explanations and the update.

I haven't experimented too much yet, but I know I can do something like this in the CTB left or right click dialog box...

Code: Select all

Global $G_FILTERS_OVERRIDE = '*.gif'; Load 'HTMLImagePreview', 'select', 'f';
One nice thing about going this route, especially if the user is strictly using this for one or two different image types, is that it saves you from needing the perm variable for the filter and if you change the default Window size as you want it, it saves needing the Window size perm as well.

Did you have an extra "Preview" in the menu?

Code: Select all

"Preview && Pr&eview && Preview Images : narrow"
Thanks again,
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [SCRIPT] HTML Image Preview

Post by TheQwerty »

klownboy wrote:I haven't experimented too much yet, but I know I can do something like this in the CTB left or right click dialog box...

Code: Select all

Global $G_FILTERS_OVERRIDE = '*.gif'; Load 'HTMLImagePreview', 'select', 'f';
One nice thing about going this route, especially if the user is strictly using this for one or two different image types, is that it saves you from needing the perm variable for the filter and if you change the default Window size as you want it, it saves needing the Window size perm as well.
As I said previously, the filters PV should be set to all the formats which can be displayed properly in HTML, not those that the user wishes to preview. This new global covers the latter case.

No need to remove any of the PVs.
klownboy wrote:Did you have an extra "Preview" in the menu?

Code: Select all

"Preview && Pr&eview && Preview Images : narrow"
Nope.. it's previews all the way down.

It shows a preview of the selected images until you quit selecting images. The label 'narrow' might shine light better as when used you're narrowing down the images with each selection. It should probably select the final image when it's a single item but meh.

klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: [SCRIPT] HTML Image Preview

Post by klownboy »

Hi TheQwerty,
I tried the "Open Images" option you suggested and it worked quite nicely. I did change the SC 'openwith' parameter from 's' to 'm' in case I had multiple images selected. Different graphics programs will behave differently I'm sure, but Image Eye would not open multiple selections unless I used 'm'. It is too bad though that 'opening' of the image couldn't be accomplished from the preview...oh well, no biggie.
Thanks again, :appl: :beer:
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: [SCRIPT] HTML Image Preview

Post by TheQwerty »

TheQwerty wrote:Change Log
  • v2.2 - 2015-05-18 13:14z
    • Adds ability to rotate previewed images.
    • Adds ability to re-order images via drag'n'drop.
    • Increases number of images which can be returned by preview.
    • Fixes escaping of amperands within image path.
  • v2.1 - 2015-03-31 17:50z
    • Adds global for specifying items which will be filtered before display.
    dls: 0 (never released)
See first post for updated script.

Papoulka
Posts: 455
Joined: 13 Jul 2013 23:41

Re: [SCRIPT] HTML Image Preview

Post by Papoulka »

Thanks for this script; it's a nice addition.

bossi
Posts: 24
Joined: 30 Jul 2022 11:09

Re: [SCRIPT] HTML Image Preview

Post by bossi »

holy shit , thats perfect , thank you for sharing

Post Reply