[imp] Inline Images (corrected)

Michael Wright michael@abditory.com
Mon, 20 May 2002 08:52:48 -0400


What version are you using? I'm using the 3.x release.

Quoting Pradit Wattanasuwan <pradit@tubtim.cri.or.th>:

> When I added your code, I got the error when i open mail.
> 
> Fatal error: Undefined class name 'sessioncache' in /var/www/horde-
> cvs/horde/imp/message.php on line 162
> 
> How to do?
> Thanks
> 
> Quoting Michael Wright <michael@abditory.com>:
> 
> > ALCON, 
> > 
> > Over the year or two that I have used IMP, I have seen several requests for
> 
> > inline images on this listserv. I haven't found code on this listserv to
> > solve 
> > this request, though I admit I may not be looking hard enough. If this 
> > functionality is already out there, please accept my apology and delete
> this
> > 
> > message with all due speed. :-) 
> > 
> > That being said, I created a little hack to work inline images into html
> > mail. 
> > The bottom line is that images cannot _truly_ be viewed inline, but you can
> 
> > view them with an <img..> tag in the html output of imp. Currently,
> images
> > are 
> > added to the attachment list and are available for viewing in a separate 
> > window. I simply took the code for this process (spanning several files)
> and
> > 
> > compiled it into the message.php file. The modification necessary is below:
> 
> > 
> > /horde/imp/message.php: 
> > 
> > To the foreach($displayParts as $ref => $mime) loop that goes through
> each
> > mime 
> > part and decides whether to inline it or add it to the attachment list,
> add
> > the 
> > following code - 
> > 
> > <code snippet> 
> > 
> >     # This code will tack any images onto the end of the body of the
> message.
> > 
> >     if(isset($mime->TYPE)) 
> >       { 
> >       if($mime->TYPE == 'image') 
> >         { 
> >         $imagepath = 'view.php?index=' . Horde::getFormData
> > ('index') . '&array_index=' . Horde::getFormData('array_index') . '&id=' .
> 
> > $mime->imap_id . '&actionID=' . 'VIEW_ATTACH' . '&mime=' . 
> > SessionCache::putObject($mime);
> > 
> >         $msg .= '<br><br><img src="' . $imagepath . '"><br><br>'; 
> >         } 
> >       } 
> > 
> > </code snippet> 
> > 
> > Bear in mind that this is a security risk and any code of mine that you
> use
> > is 
> > strictly "as-is" and no guarantees are packaged with it. 
> > 
> > A screenshot of this working can be found here: 
> > 
> > http://www.abditory.com/modules.php? 
> > 
> 
set_albumName=Screenshots&id=aab&op=modload&name=Gallery&file=index&include=vie
> w
> > _photo.php 
> > 
> > 
> > 
> > -=-=-=-=-=-=-=-=-=-=-=-=
> > http://www.abditory.com
> > 
> > For when you just can't
> > get enough of me!
> > -=-=-=-=-=-=-=-=-=-=-=-=
> > 
> > -- 
> > IMP mailing list
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: imp-unsubscribe@lists.horde.org
> > 
> 
> 
> -- 
> Pradit Wattanasuwan
> Office of Computer Services
> Chulabhorn Research Institute
> 54 Vibhavadee-Rangsit Highway,
> Bangkok 10210, Thailand.
> Tel: (662)574-3155 ext 13
> 
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
> 


-=-=-=-=-=-=-=-=-=-=-=-=
http://www.abditory.com

For when you just can't
get enough of me!
-=-=-=-=-=-=-=-=-=-=-=-=