Alternatives to IrfanView in PuppyLinux:

Paint programs, vector editors, 3d modelers, animation editors, etc.
Message
Author
User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#31 Post by puppy_apprentice »

musher0 wrote:"file://localhost" has 16 characters, not 7. Cutting at 7 chars, mtpaint does
not know how to interpret the "localhost" part.
Om my machine (firefox) path is always:

Code: Select all

file:///mnt/etc.
so URL have to be shorten for 16 or 7 depends if there will be "localhost" or not.
musher0 wrote:Also, I think it would need an exit button as well, and / or or some way to
close the yad tray icon -- on the icon -- once we have finished. Because,
as it is, it stays there forever; I had to run < killall yad > to get rid of it.
You can close YAD icon by MMB (middle mouse button) or wheel.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#32 Post by musher0 »

Hi.

As I recall, the real expression is file://localhost; file:/// is shorthand.

I suppose the script will have to accommodate the browser's way of
expressing it. May I suggest one of the five ways to detect it, here.

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#33 Post by Semme »

8) Good stuff PA -- I like!
Image
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#34 Post by puppy_apprentice »

+ exit
+ check for 'localhost'

Code: Select all

#!/bin/sh
# /root/my-applications/bin/browser-picture-viewer.sh
# Author: "Puppy_Apprentice", Nov. 5 2018
# Source: http://www.murga-linux.com/puppy/viewtopic.php?p=1009207#1009207
####

if [[ ! -e "index.html" ]]; then
    echo -e "<!DOCTYPE html>\n<html>\n<head>\n<title>Browser Picture Viewer</title>\n</head>\n<frameset cols=\"*,235px\">\n<frame src=\"\" name=\"view\">\n<frame src=\"gallery.html\">\n</frameset>\n</html>" >index.html
fi

LIST=$(ls -1 *.{jpg,png} 2> /dev/null)

echo -e "<!DOCTYPE html>\n<html>\n<body>" >gallery.html
echo -e "<h3>Pictures from $PWD dir:</h3>\n<br>" >>gallery.html
for Line in $LIST
do
   echo "<a href=\"$Line\" target=\"view\"><img src=\"$Line\" alt=\"$Line\" width=\"196\" height=\"110\"></a>" >>gallery.html
done

echo -e "</body>\n</html>" >>gallery.html

defaultbrowser $PWD/index.html & # but browser should know frames

send_to() {
    if which xclip >/dev/null 2>&1; then
       clip=$(xclip -selection clipboard -o)
    else
       clip=$(xsel --clipboard -o)
    fi

    if [[ $clip =~ "localhost" ]]; then
       clip=${clip:16}
    else
       clip=${clip:7}
    fi

    gxmessage -name "Send to..." -nearmouse -buttons "mtPaint:42,PeasyPrint:52,Cancel:62,Exit:72" "$clip"

    case $? in
       42) mtpaint "$clip";;
       52) peasyprint "$clip";;
       72) killall yad --notification --kill-parent --listen --image="/root/.usr/share/midi-icons/paint48.png" --text="Send to..." --command="sh -c send_to";;
       *)
    esac

}

export -f send_to

PIPE="/tmp/snippets_${USER}_${$}"
mkfifo "$PIPE"
exec 3<> "$PIPE"
trap 'echo "quit" >&3; rm -f "$PIPE"' EXIT

yad --notification --kill-parent --listen --image="/root/.usr/share/midi-icons/paint48.png" --text="Send to..." --command="sh -c send_to" <&3

exit
Attachments
Screenshot_2018-11-06_151505.jpg
(65.54 KiB) Downloaded 241 times
browser-picture-viewer.sh.gz
fake gz
(1.72 KiB) Downloaded 230 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#35 Post by musher0 »

Thanks, Puppy_Apprentice. The features that you added work well.

If I may, would it be possible to stabilize the picture shown? I mean:
separate it from the scrolling list of pictures?

Of course the chosen picture has to change when a new one is chosen, but
while we choose (scrolling down the list on the right), could it stay in place
and not scroll down too? I find it a bit confusing the way it is.

On the other hand, if it's doing this only on my old Opera, don't bother.

TIA. BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#36 Post by musher0 »

Surprisingly, the links2 browser does this separation naturally, by default.
Attachments
links-picture-viewer.jpg
(85.11 KiB) Downloaded 217 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#37 Post by puppy_apprentice »

I think it is browser dependent. Sometimes browsers render pages differently.

You can check this part of code:

Code: Select all

if [[ ! -e "index.html" ]]; then
   echo -e "<!DOCTYPE html>\n<html>\n<head>\n<title>Browser Picture Viewer</title>\n</head>\n<frameset cols=\"*,235px\">\n<frame src=\"\" name=\"view\">\n<frame src=\"gallery.html\">\n</frameset>\n</html>" >index.html
fi
Especialy this part:

Code: Select all

<frameset cols=\"*,235px\">
Thumnails part is 235 pixels wide.
Viewer part has '*' symbol that means window - 235 pixels.
Try to put instead of '*' eg. 1024 (or something near your screen size) - 235.

And this part:

Code: Select all

<frame src=\"\" name=\"view\">\n<frame src=\"gallery.html\">
Change to:

Code: Select all

<frame src=\"\" name=\"view\" scrolling=\"yes\">\n<frame src=\"gallery.html\" name=\"thumbs\" scrolling=\"yes\">
Maybe this help. Another solution is to use iFrames instead of Frames. But i'm not sure if Opera will render iFrames the same like Mozilla family browsers. Or maybe some JavaScript or CSS code is needed.

BTW. In Firefox you can move middle slider to change width of two parts. And F11 change view to full screen.

My browser viewer has one problem. It has to render all thumbnails. If pictures are very big and you have them many in directory loading will be very slow and memory usage big, especially without HDD and swap partition. But it is possible to make 'select' gadget instead of thumbnails.
Attachments
Screenshot_2018-11-06_175006.jpg
Middle slider movable.
(104.09 KiB) Downloaded 217 times

Post Reply