Jump to content
xt:Commerce Community Forum

Bilder mit echtem transparenten Wasserzeichen


dirkbartholomae

Recommended Posts

Wir verwenden als Wasserzeichen ("merge") für unsere Shop-Bilder 24-Bit PNG-Dateien die einen echten Alpha-Kanal enthalten. Die aktuelle Shopsoftware ignoriert das.

Wer das beheben will, kann in v3.0.4 SP2.1 in admin/include/classes/image_manipulator_GD2.php ab Zeile 183 folgendes einfügen:

        if ($this->md[2] == 3) {

            imageAlphaBlending($this->mm, false);

            imageSaveAlpha($this->mm, true);

            @imagecopy($this->t, $this->mm, $this->xx, $this->yy, 0, 0, $this->mw, $this->mh);

        }

        else {

            for($this->ypo = 0; $this->ypo < $this->mh; $this->ypo++)

                {

                for($this->xpo = 0; $this->xpo < $this->mw; $this->xpo++)

                    {

                    $this->indx_ref = @imagecolorat($this->mm, $this->xpo, $this->ypo);

                    $this->indx_rgb = @imagecolorsforindex($this->mm, $this->indx_ref);

                    if(($this->indx_rgb['red'] == $this->tr) && ($this->indx_rgb['green'] == $this->tg) && ($this->indx_rgb['blue'] == $this->tb))

                        {

                        // transparent colour, so ignore merging this pixel

                        }

                    else

                        {

                        @imagecopymerge($this->t, $this->mm, $this->xx+$this->xpo, $this->yy+$this->ypo, $this->xpo, $this->ypo, 1, 1, $this->mo);

                        }

                    }

                }

        }
Vorher stand da nur:
            for($this->ypo = 0; $this->ypo < $this->mh; $this->ypo++)

                {

                for($this->xpo = 0; $this->xpo < $this->mw; $this->xpo++)

                    {

                    $this->indx_ref = @imagecolorat($this->mm, $this->xpo, $this->ypo);

                    $this->indx_rgb = @imagecolorsforindex($this->mm, $this->indx_ref);

                    if(($this->indx_rgb['red'] == $this->tr) && ($this->indx_rgb['green'] == $this->tg) && ($this->indx_rgb['blue'] == $this->tb))

                        {

                        // transparent colour, so ignore merging this pixel

                        }

                    else

                        {

                        @imagecopymerge($this->t, $this->mm, $this->xx+$this->xpo, $this->yy+$this->ypo, $this->xpo, $this->ypo, 1, 1, $this->mo);

                        }

                    }

                }

Setzt Nutzung von GD2 vorraus.

Viel Spaß - vielleicht findet es ja seinen Weg in ein Release.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
  • Create New...