Subject: Viewing images in pine from console

From: Meph Istopheles <[email-masked]>
Date: Mon, 1 Nov 2004 12:12:59 -0800 (PST)

I'd posted this with a different Subject, but I don't think it 
conveyed things well, so I'm trying again with a different 
Subject.

   I'd recently gone back to slackware from mdk, as I'm really 
tired of the hassles with X apps (one of the reasons I'd switched 
to Linux some years ago from Windows apps) & am running pine from 
the console.  I also have framebuffer running & can open images 
from the command line of any console with an image viewer called 
fbi.

   But, putting the path to fbi in the image-viewer line in config 
(.pinerc) doesn't actually do anything when I attempt to view an 
attached image but tell me that the viewer command has launched.

   Is there something else I have to put in the .pinerc to make 
this work?

-- 
   Ask Not for whom the Bell Tolls, and You will Pay only the
   Station-to-Station rate.
-- 
-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Scott Swanson <[email-masked]>
Date: Thu, 4 Nov 2004 15:53:21 -0700 (MST)

> attached image but tell me that the viewer command has launched.

I tried to use zgv in the same way, with the same result. I then
experimented a little by writing a small shell script to call instead. The
script gets called with one argument, being the temporary conversion of
the mime attachment (in my case, /tmp/img-JPE017056 - no extension). I
thought at first I could just add an extension on and run the viewer, but
that didn't work either. So, I just made a copy of the temporary file and
ran the viewer on that; worked fine.

So in pine, I have the viewer command set to: zgv-wrapper %s

Where zgv-wrapper is an executable in my PATH:

#!/bin/sh
cp $1 /tmp/temp-zgv-file.jpeg
zgv /tmp/temp-zgv-file.jpeg

I tried removing the temporary file after the view, and it went back to
the old behaviour, so the failure has something to do with the
temporariness of the converted image file.  Maybe somebody wiser than I
can explain why. Incidentally, I tested this on a gif and zgv works fine
despite the jpeg name, so your viewer is probably the same.

HTH,

Scott Swanson

---

From: robert delius royar <[email-masked]>
Date: Fri, 5 Nov 2004 05:08:40 -0500 (EST)

> despite the jpeg name, so your viewer is probably the same.

Pine appears to be in a rush to delete the file as soon as the viewer (or 
its script exits.  I use the following (note the `sleep 20' after the open 
command returns.  On OS X open runs default programs based on file types. 
It runs the program in the background.  I also got tired of viewers exiting 
when Pine quit--especially the web browser. The case statement looks to see 
the symbolic link name of the file.  The viewers defined in the mime/mailcap 
and pinerc sections get called based on the original file type.

#!/bin/sh

Run () {
     case $1 in
 	*.pdf|*.gif|*.png|*.tiff|*.jpg ) imgdo $1 ;;
 	* ) nodo $1 ;;
     esac
}

nodo ()
{
     case $0 in
 		*runpdf ) FILENAME="$1.pdf" ;;
 		*rungif ) FILENAME="$1.gif" ;;
 		*runtiff ) FILENAME="$1.tiff" ;;
 		*runjpg ) FILENAME="$1.jpg" ;;
 		*runpng ) FILENAME="$1.png" ;;
 		* ) echo No match ;;
     esac
 	if [ -e $1 ]; then
 		cp -p $1 $FILENAME
 		/usr/bin/open $FILENAME
 		sleep 20
 		rm $FILENAME
 	else
 		echo No $1
 	fi
}

imgdo ()
{
 	/usr/bin/open -a /Applications/Preview.app $1
 	sleep 20
}

Run $*

-- 
Dr. Robert Delius Royar                   Associate Professor of English
Morehead State University                             Morehead, Kentucky

---

From: Matt Ackeret <[email-masked]>
Date: Fri, 5 Nov 2004 12:09:05 -0800 (PST)

On Fri, 5 Nov 2004, robert delius royar wrote:
> Pine appears to be in a rush to delete the file as soon as the viewer (or its
> script exits.  

Do the files go in /tmp?  Seems like if they do, then it'd be reasonable for
pine to not clean them up until it quits (and putting them in /tmp is also a
safeguard in case pine crashes since it's cleaned up automatically).