The watermark width must be smaller that a vertical thumb width.
The question is asked frequently. So we have modified the process a little (the script's version was not released else)
You could edit the file:
/admin/function/functions.php
and replace the code:
- Code: Select all
//Watermark
function watermark($img_sourse,$png_file)
{
global $watermark_position;
$im1 = imagecreatefrompng($png_file);
$im2 = ImageCreateFromJPEG($img_sourse);
$sz = getimagesize($img_sourse);
$wz = getimagesize($png_file);
$px=0;
$py=0;
if($wz[0]<$sz[0] and $wz[1]<$sz[1])
{
if($watermark_position==1)
{
$px=0;
$py=0;
}
elseif($watermark_position==2)
{
$px=($sz[0]-$wz[0])/2;
$py=0;
}
elseif($watermark_position==3)
{
$px=$sz[0]-$wz[0];
$py=0;
}
elseif($watermark_position==4)
{
$px=0;
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==5)
{
$px=($sz[0]-$wz[0])/2;
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==6)
{
$px=$sz[0]-$wz[0];
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==7)
{
$px=0;
$py=$sz[1]-$wz[1];
}
elseif($watermark_position==8)
{
$px=($sz[0]-$wz[0])/2;
$py=$sz[1]-$wz[1];
}
else
{
$px=$sz[0]-$wz[0];
$py=$sz[1]-$wz[1];
}
}
imagecopy($im2,$im1, $px, $py, 0, 0,$wz[0],$wz[1]);
//imageinterlace($im2, true);
ImageJPEG($im2,$img_sourse,100);
ImageDestroy($im1);
ImageDestroy($im2);
}
with:
- Code: Select all
//Watermark
function watermark($img_sourse,$png_file)
{
global $watermark_position;
$im1 = imagecreatefrompng($png_file);
$im2 = ImageCreateFromJPEG($img_sourse);
$sz = getimagesize($img_sourse);
$wz = getimagesize($png_file);
$px=0;
$py=0;
$wx=0;
$wy=0;
if($wz[0]<$sz[0] and $wz[1]<$sz[1])
{
if($watermark_position==1)
{
$px=0;
$py=0;
}
elseif($watermark_position==2)
{
$px=($sz[0]-$wz[0])/2;
$py=0;
}
elseif($watermark_position==3)
{
$px=$sz[0]-$wz[0];
$py=0;
}
elseif($watermark_position==4)
{
$px=0;
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==5)
{
$px=($sz[0]-$wz[0])/2;
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==6)
{
$px=$sz[0]-$wz[0];
$py=($sz[1]-$wz[1])/2;
}
elseif($watermark_position==7)
{
$px=0;
$py=$sz[1]-$wz[1];
}
elseif($watermark_position==8)
{
$px=($sz[0]-$wz[0])/2;
$py=$sz[1]-$wz[1];
}
else
{
$px=$sz[0]-$wz[0];
$py=$sz[1]-$wz[1];
}
}
if($wz[0]>=$sz[0] and $wz[1]>=$sz[1])
{
$px=0;
$py=0;
$wx=($wz[0]-$sz[0])/2;
$wy=($wz[1]-$sz[1])/2;
}
if($wz[0]<$sz[0] and $wz[1]>=$sz[1])
{
$px=($sz[0]-$wz[0])/2;
$py=0;
$wx=0;
$wy=($wz[1]-$sz[1])/2;
}
if($wz[0]>=$sz[0] and $wz[1]<$sz[1])
{
$px=0;
$py=($sz[1]-$wz[1])/2;
$wx=($wz[0]-$sz[0])/2;
$wy=0;
}
imagecopy($im2,$im1, (int)$px, (int)$py, (int)$wx, (int)$wy,$wz[0],$wz[1]);
//imageinterlace($im2, true);
ImageJPEG($im2,$img_sourse,100);
ImageDestroy($im1);
ImageDestroy($im2);
}