mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-16 04:59:42 +01:00
Update watermark.php
This commit is contained in:
@@ -44,12 +44,12 @@ function helper_watermark($name, $ext)
|
|||||||
if (file_exists(dirname(__FILE__) . '/../../images/watermark.png'))
|
if (file_exists(dirname(__FILE__) . '/../../images/watermark.png'))
|
||||||
{
|
{
|
||||||
$logo_path= dirname(__FILE__) . '/../../images/watermark.png';
|
$logo_path= dirname(__FILE__) . '/../../images/watermark.png';
|
||||||
$src_logo = imagecreatefrompng($logo_path);
|
$src_logo = @imagecreatefrompng($logo_path);
|
||||||
}
|
}
|
||||||
elseif (file_exists(dirname(__FILE__) . '/../../images/watermark.gif'))
|
elseif (file_exists(dirname(__FILE__) . '/../../images/watermark.gif'))
|
||||||
{
|
{
|
||||||
$logo_path= dirname(__FILE__) . '/../../images/watermark.gif';
|
$logo_path= dirname(__FILE__) . '/../../images/watermark.gif';
|
||||||
$src_logo = imagecreatefromgif($logo_path);
|
$src_logo = @imagecreatefromgif($logo_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//no watermark pic
|
//no watermark pic
|
||||||
@@ -64,40 +64,46 @@ function helper_watermark($name, $ext)
|
|||||||
helper_watermark_imagick($name, $ext, $logo_path);
|
helper_watermark_imagick($name, $ext, $logo_path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//now, lets work and detect our image extension
|
||||||
|
list($bwidth, $bheight, $src_img_type) = getimagesize($name);
|
||||||
|
|
||||||
|
$src_img = false;
|
||||||
|
|
||||||
|
switch ($src_img_type)
|
||||||
|
{
|
||||||
|
case IMAGETYPE_GIF:
|
||||||
|
//$src_img = imagecreatefromgif($name);
|
||||||
|
return;
|
||||||
|
|
||||||
//now, lets work and detect our image extension
|
break;
|
||||||
if (strpos($ext, 'jp') !== false)
|
|
||||||
{
|
|
||||||
$src_img = @imagecreatefromjpeg($name);
|
|
||||||
}
|
|
||||||
elseif (strpos($ext, 'png') !== false)
|
|
||||||
{
|
|
||||||
$src_img = @imagecreatefrompng($name);
|
|
||||||
}
|
|
||||||
elseif (strpos($ext, 'gif') !== false)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
// $src_img = @imagecreatefromgif($name);
|
|
||||||
}
|
|
||||||
elseif (strpos($ext, 'bmp') !== false)
|
|
||||||
{
|
|
||||||
if (! defined('BMP_CLASS_INCLUDED'))
|
|
||||||
{
|
|
||||||
include dirname(__file__) . '/BMP.php';
|
|
||||||
define('BMP_CLASS_INCLUDED', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$src_img = imagecreatefrombmp($name);
|
case IMAGETYPE_JPEG:
|
||||||
|
$src_img = imagecreatefromjpeg($name);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IMAGETYPE_PNG:
|
||||||
|
$src_img = imagecreatefrompng($name);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IMAGETYPE_BMP:
|
||||||
|
if (! function_exists('imagecreatefrombmp'))
|
||||||
|
{
|
||||||
|
include dirname(__file__) . '/BMP.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$src_img = imagecreatefrombmp($name);
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (! $src_img)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//detect width, height for the image
|
|
||||||
$bwidth = @imagesx($src_img);
|
|
||||||
$bheight = @imagesy($src_img);
|
|
||||||
|
|
||||||
//detect width, height for the watermark image
|
//detect width, height for the watermark image
|
||||||
$lwidth = @imagesx($src_logo);
|
$lwidth = @imagesx($src_logo);
|
||||||
$lheight = @imagesy($src_logo);
|
$lheight = @imagesy($src_logo);
|
||||||
|
|||||||
Reference in New Issue
Block a user