Lotus Notes and png

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
maxxx
Posts: 5
Joined: Mon Oct 16, 2006 4:06 am

Lotus Notes and png

Post by maxxx »

Lotus Notes are unable to render inline png picuters and I was wondering
if it is possible to send graphs in different formats (jpg, bmp)?
Can this be easily done? Or will I have to hack thold plugin?

Regards, max
cigamit
Developer
Posts: 3373
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Re: Lotus Notes and png

Post by cigamit »

maxxx wrote:Lotus Notes are unable to render inline png picuters and I was wondering
if it is possible to send graphs in different formats (jpg, bmp)?
Can this be easily done? Or will I have to hack thold plugin?

Regards, max
Hum... not sure how easy it will be, but I can probably make it a gif, and add an option for it without too much trouble.
maxxx
Posts: 5
Joined: Mon Oct 16, 2006 4:06 am

Post by maxxx »

Hi,

I modifed thold_mail function, now it sends picture as attachment:
//$mail->AddStringEmbedAttachment($data, .....)
$mail->AddStringAttachment($data, ....);
//$mail->Body .= "<br><br><img src='cid:$cid'>";

This kind of solves my problem. It would be better to see the graph
inline ... maybe in next LN version :)

Regards, max
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I think the newest, not released, version of Lotus notes supports PNG. But then again, it was just hearsay from a IBM employee...
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
uhtred
Cacti User
Posts: 121
Joined: Fri Oct 09, 2009 8:59 am
Location: Germany

Post by uhtred »

hi,

for people, who using lotus notes and still have problems with the mails
(thold 4.1). here is a workaround, cause notes still doesn't support png:

requirement: php-gd

add this to thold_functions.php:
/**
* This function is stolen from NECTAR
* convert png images stream to jpeg using php-gd
*
* @param unknown_type $png_data the png image as a stream
* @return unknown the jpeg image as a stream
*/
function png2jpeg ($png_data) {
global $config;
if ($png_data != "") {
$fn = "/tmp/" . time() . '.png';
/* write rrdtool's png file to scratch dir */
$f = fopen($fn, 'wb');
fwrite($f, $png_data);
fclose($f);
/* create php-gd image object from file */
$im = imagecreatefrompng($fn);
if (!$im) { /* check for errors */
$im = ImageCreate (150, 30); /* create an empty image */
$bgc = ImageColorAllocate ($im, 255, 255, 255);
$tc = ImageColorAllocate ($im, 0, 0, 0);
ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
/* print error message */
ImageString($im, 1, 5, 5, "Error while opening: $imgname", $tc);
}
ob_start(); // start a new output buffer to capture jpeg image stream
imagejpeg($im); // output to buffer
$ImageData = ob_get_contents(); // fetch image from buffer
$ImageDataLength = ob_get_length();
ob_end_clean(); // stop this output buffer
imagedestroy($im); //clean up
unlink($fn); // delete scratch file
}
return $ImageData;
}

and change this in thold_functions.php:
-$data = rrdtool_function_graph($val['local_graph_id'], $val['rra_id'],
$graph_data_array);
+$data = png2jpeg(rrdtool_function_graph($val['local_graph_id'], $val['rra_id'],
$graph_data_array));
-if ($Mailer->attach($data, $val['filename'].'.png', 'image/png', 'inline', $cid) ==
false) {
+if ($Mailer->attach($data, $val['filename'].'.jpg', 'image/jpg', 'inline', $cid) == false)
{

after this changes, you will get mail with jpg instead of png and u will see the little pictures.

regards
System: Ubuntu 10.04lts@64bit, 2*X5650, 12GB, Cacti 0.8.7g, Spine 0.8.7g, PA2.9, Weathermap 0.97a, CAMM 1.6.75, monitor 1.3.1, realtime 0.43, thold 0.4.9.3, manage 0.6.2, mactrack 2.9(.1) ---- 508 devices, 6741 items, 4263 ds, time 7.01s, intervall 60, proc. 12, threads 14, php server 8
User avatar
TheWitness
Developer
Posts: 17062
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Can you please open a bug report here: http://bugs.cacti.net and attach a patch from the vanilla. You might want to attached the fully modified files too.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
uhtred
Cacti User
Posts: 121
Joined: Fri Oct 09, 2009 8:59 am
Location: Germany

Post by uhtred »

done
System: Ubuntu 10.04lts@64bit, 2*X5650, 12GB, Cacti 0.8.7g, Spine 0.8.7g, PA2.9, Weathermap 0.97a, CAMM 1.6.75, monitor 1.3.1, realtime 0.43, thold 0.4.9.3, manage 0.6.2, mactrack 2.9(.1) ---- 508 devices, 6741 items, 4263 ds, time 7.01s, intervall 60, proc. 12, threads 14, php server 8
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests