phalcon / cphalcon

High performance, full-stack PHP framework delivered as a C extension.
https://phalcon.io
BSD 3-Clause "New" or "Revised" License
10.79k stars 1.96k forks source link

[BUG]: Watermark offsetX does not work #16658

Closed borisdelev closed 1 month ago

borisdelev commented 1 month ago

Describe the bug: Offset for watermark on image do not work.

This is part of zephir 5.8.0 file (https://github.com/phalcon/cphalcon/blob/master/phalcon/Image/Adapter/AbstractAdapter.zep):

    /**
     * Add a watermark to an image with the specified opacity
     *
     * @param AdapterInterface $watermark
     * @param int              $offsetX
     * @param int              $offsetY
     * @param int              $opacity
     *
     * @return AdapterInterface
     */
    public function watermark(
        <AdapterInterface> watermark,
        int offsetX = 0,
        int offsetY = 0,
        int opacity = 100
    ) -> <AdapterInterface> {
        var op, x, y;

        let x    = this->checkHighLow(
            offsetX,
            0,
            this->width - watermark->getWidth()
        );

        let y    = this->checkHighLow(
            offsetX,
            0,
            this->height - watermark->getHeight()
        );

        let op = this->checkHighLow(opacity);

        this->{"processWatermark"}(watermark, x, y, opacity);

        return this;
    }

... so offsetY is not used. Well... it is a little mistake.

Greetings

niden commented 1 month ago

Resolved in https://github.com/phalcon/cphalcon/pull/16659

Thank you @borisdelev