My cellphone only supports JPG, so in order to get the image sent as JPG I downloaded ImageMagick (http://www.imagemagick.org/script/index.php) and then modified the thold-functions.php and modified the following lines (line numbers might be off a bit, but you'll get close enough). I've also attached the modified file. Make sure you backup your old file before using this one.
The tmpdir can be anywhere but must pretty much have rw-rw-rw- for it to work. At first I tried the /tmp, but it didn't work.
line 91:
$file_array = array(0 => array('local_graph_id' => $graph_id, 'rra_id' => 0, 'file' => "$httpurl/graph_image.php?local_graph_id=$graph_id&rra_id=0&graph_height=100&graph_width=250",'mimetype'=>'image/jpg','filename'=>"$graph_id"));
line 785:
$graph_data_array = array("output_flag" => RRDTOOL_OUTPUT_STDOUT, "graph_height" => 100, "graph_width" => 250);
line 788:
// adding jpg support
$tmpdir = "/usr/local/apache2/htdocs/cacti/plugins/thold/tmp/";
$pngfile = $tmpdir.$val['filename'].".png";
$jpgfile = $tmpdir.$val['filename'].".jpg";
$handle = fopen($pngfile,'w+');
fwrite($handle, $data);
fclose($handle);
$command = "/usr/local/bin/convert ".$pngfile." ".$jpgfile;
exec($command);
$jhandle = fopen($jpgfile,'r');
$jdata = fread($jhandle, filesize($jpgfile));
fclose($jhandle);
$cid = md5(uniqid(time()));
$mail->AddStringEmbedAttachment($jdata, $val['filename'].'.jpg', $cid, 'base64', $val['mimetype']); // optional name
// adding jpg support
[HOWTO] JPEG support in Cacti & Thold using ImageMagick
Moderators: Developers, Moderators
-
- Posts: 3
- Joined: Wed May 03, 2006 5:25 pm
[HOWTO] JPEG support in Cacti & Thold using ImageMagick
- Attachments
-
- thold-functions.zip
- Updated thold-functions.php
- (8.77 KiB) Downloaded 379 times
Last edited by kschlegelmilch on Wed Jul 25, 2007 10:59 am, edited 4 times in total.
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Strange, what cell phone is this?
[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]
[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]
-
- Posts: 3
- Joined: Wed May 03, 2006 5:25 pm
- rony
- Developer/Forum Admin
- Posts: 6022
- Joined: Mon Nov 17, 2003 6:35 pm
- Location: Michigan, USA
- Contact:
Lotus Notes doesn't support png at all.
I find this interesting and may add this to the mailer class I wrote for the PIA.
I find this interesting and may add this to the mailer class I wrote for the PIA.
[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]
[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]
Who is online
Users browsing this forum: No registered users and 1 guest