Skygge på billeder med php
Er der nogle der kender til en php-funktion, hvor man kan lave skygger bag billeder? altså give visningen af billedet lidt dybde. Jeg har selv fundet nedenstående funktion, men den er en del af kæmpe Thumbnail-klasse (med et væld af andre funktioner), som jeg helst ikke gider have liggende. Jeg hat thumbnailen/billedfilen og ønsker blot lidt udseende.function drop_shadow($shadow_width, $shadow_colour, $background_colour){
$this->sw = $shadow_width;
$this->sc = $shadow_colour;
$this->sbr = $background_colour;
$this->sr = $this->hex2rgb(substr($this->sc,0,2));
$this->sg = $this->hex2rgb(substr($this->sc,2,2));
$this->sb = $this->hex2rgb(substr($this->sc,4,2));
$this->sbrr = $this->hex2rgb(substr($this->sbr,0,2));
$this->sbrg = $this->hex2rgb(substr($this->sbr,2,2));
$this->sbrb = $this->hex2rgb(substr($this->sbr,4,2));
$this->dot = ImageCreate(1,1);
$this->dotc = ImageColorAllocate($this->dot, $this->sr, $this->sg, $this->sb);
$this->v = imagecreatetruecolor($this->q, $this->r);
$this->sbc = imagecolorallocate($this->v, $this->sbrr, $this->sbrg, $this->sbrb);
$this->rsw = $this->q-$this->sw;
$this->rsh = $this->r-$this->sw;
imagefill($this->v, 0, 0, $this->sbc);
for($this->sws = 0; $this->sws < $this->sw; $this->sws++)
{
$this->s_opac = max(0, 90-($this->sws*(100 / $this->sw)));
for($this->sde = $this->sw; $this->sde < $this->rsh+$this->sws+1; $this->sde++)
{
imagecopymerge($this->v, $this->dot, $this->rsw+$this->sws, $this->sde, 0, 0, 1, 1, $this->s_opac);
}
for($this->bse = $this->sw; $this->bse < $this->rsw+$this->sws; $this->bse++)
{
imagecopymerge($this->v, $this->dot, $this->bse, $this->rsh+$this->sws, 0, 0, 1, 1, $this->s_opac);
}
}
imagecopyresampled($this->v, $this->t, 0, 0, 0, 0, $this->rsw, $this->rsh, $this->q, $this->r);
imagecopyresampled($this->t, $this->v, 0, 0, 0, 0, $this->q, $this->r, $this->q, $this->r);
imagedestroy($this->v);
imagedestroy($this->dot);
}
På forhånd tak:-)