Got an enhancement for mtChart.
If you need to draw an image to the Graph and would like to resize it
right use this function drawFromPictureResized. You can basically pass
jpg, png and gif images. PHP should autodetect on loading the image to
the image object.
/**
* Load Image from any image file and resize it.
* */
public function drawFromPictureResized($FileName, $X, $Y,
$W=false, $H=false) {
if (file_exists($FileName)) {
$Infos = getimagesize($FileName);
$Width = $Infos[0];
$Height = $Infos[1];
$NewWidth = ($W) ? $W : $Width;
$NewHeight = ($H) ? $H : $Height;
$Raster = imagecreatefromstring(file_get_contents
($FileName));
imagecopyresampled($this->Picture, $Raster, $X, $Y, 0, 0,
$NewWidth, $NewHeight, $Width, $Height);
imagedestroy($Raster);
return true;
}
}
Original issue reported on code.google.com by repthe...@gmail.com on 30 Sep 2009 at 8:47
Original issue reported on code.google.com by
repthe...@gmail.com
on 30 Sep 2009 at 8:47