|
|
| Author |
Message |
kschlegelmilch
Joined: 03 May 2006 Posts: 3
|
Posted: Tue Jul 24, 2007 4:55 pm Post subject: [HOWTO] JPEG support in Cacti & Thold using ImageMagick |
|
|
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
| Description: |
| Updated thold-functions.php |
|
 Download |
| Filename: |
thold-functions.zip |
| Filesize: |
8.77 KB |
| Downloaded: |
118 Time(s) |
Last edited by kschlegelmilch on Wed Jul 25, 2007 10:59 am; edited 4 times in total |
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5469 Location: Wisconsin, USA
|
Posted: Tue Jul 24, 2007 5:08 pm Post subject: |
|
|
| Strange, what cell phone is this?
|
|
| Back to top |
|
 |
kschlegelmilch
Joined: 03 May 2006 Posts: 3
|
Posted: Tue Jul 24, 2007 5:23 pm Post subject: |
|
|
| rony wrote: | | Strange, what cell phone is this? |
Samsung Trace
I would get the link, but no PNG image.
This would also help the Lotus Notes people too. I guess email in Lotus Notes doesn't support inline PNG images either.
|
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5469 Location: Wisconsin, USA
|
Posted: Wed Jul 25, 2007 8:48 am Post subject: |
|
|
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.
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|