Jump to content
Sign in to follow this  
sergm87

Наложение водяного знака. теряется прозранчость

Recommended Posts

если исходная картинка в в формате Png. то водяной знак теряет свою прозрачность, накладывается белым прямоугольником. как исправить?

Share this post


Link to post
Share on other sites

писать автору используемого модуля.

или курить доки.

или привести код (если ты разработчик и сам писал наложение водяного знака).

Share this post


Link to post
Share on other sites

используются стандартная функция Opencart

Share this post


Link to post
Share on other sites

движок?

версия?

код?

Share this post


Link to post
Share on other sites

движок?

версия?

код?

opencart 1.5.4

 public function resize($filename, $width, $height, $watermark = true) {if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
            return;
        }

        $info = pathinfo($filename);
        $extension = $info['extension'];

        $old_image = $filename;
        $new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;

        if (!file_exists(DIR_IMAGE . $new_image) || (filemtime(DIR_IMAGE . $old_image) > filemtime(DIR_IMAGE . $new_image))) {
            $path = '';

            $directories = explode('/', dirname(str_replace('../', '', $new_image)));

            foreach ($directories as $directory) {
                $path = $path . '/' . $directory;

                if (!file_exists(DIR_IMAGE . $path)) {
                    @mkdir(DIR_IMAGE . $path, 0777);
                }
            }

            list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);

            if ($width_orig != $width || $height_orig != $height) {
                $image = new Image(DIR_IMAGE . $old_image);
                $image->resize($width, $height);
				
                if ($watermark) {
				
				if ($width<200) {
                    $image->watermark(DIR_IMAGE . 'wsmall.png', 'bottomleft'); } else {
                    $image->watermark(DIR_IMAGE . 'watermark.png', 'bottomleft'); }
                }//if
                $image->save(DIR_IMAGE . $new_image);
            } else {
                copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
            }
        }

Share this post


Link to post
Share on other sites

этого кода недостаточно.

надо смотреть system/library/image.php

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.