Midgard Mind Reduction

2004-06-23 Bubbly bubble

By now you all propably know that Nemein's website is being redesigned with a talented graphical gesigner Lasse Larvanko. And well it naturally conserns me too so today I did my part for the new site...though I'v got a feeling that there will be more, which is nice. I hope it will be something with Midgard because really I need the practice.

We were discussing the new layout yeterday and there are these round images here and there that we call "bubbles". We like dynamic things so there is no chance we are going to make the "bubbles" one by one with Gimp, especially if they are changing every month or something. I had made some image manipulation with PHP previously so Bergie gave me the job to write a script that makes the so called "bubbles".

The first version is ready now and I think it does the things we wanted it to go except for a little matter with resampling an image that has transparent areas. I don't know if this is a bug in PHP or am I doing something wrong but doing "imagecopyresampled()" and "imagecolortransparent()" on the same image doesn't work the way it should...
//This creates the bubble
function bubble ($path,$widht,$height) {
$img = $this->loadpng($path);
//$img = $this->resample($img,$widht,$height);
$diameter = $this->diameter($img);
$border = imagecolorallocate($img,100,100,100);
$frame = imagecolorallocate($img,200,50,60);
$cx = $this->sweetspot($img, "x");
$cy = $this->sweetspot($img, "y");
imageellipse($img,$cx,$cy,$diameter,$diameter,$border);
imagefilltoborder($img,0,0,$border,$frame);
imagecolortransparent($img, $frame);
return $img;
}
I'll continue figuring it out...

User comments

Post a comment

Commenting is allowed only for authenticated users