Webmaster Forum

Ezilon Directory   Improve your ranking, submit to directories   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 12-23-2006, 07:50 PM   #1 (permalink)
Inactive
 
Join Date: 12-23-06
Posts: 9
iTrader: 0 / 0%
Latest Blog:
None

ycpc55 is liked by many
Question watermark png no resize

hi
i was wondering if anyone can help me out with this watermark script my problem is that the png image is resizing with all my images i have to watermark in the folder here is 2 link so you can see what im talking about im trying to get it so it will stay one size and not strech thanks....

click here link 1

click here link 2

PHP Code:
<? 


 
// IMAGE WATERMARK (comment line below if you do not want to use image watermark) 
 
Define('WATERMARK_IMAGE''./wt.png'); // path to watermark image 
 
Define('WATERMARK_PERCENT''100'); // Intensity of the transition (in percent) 


 // TEXT WATERMARK (comment line below if you do not want to use text) 
 //Define('WATERMARK_TEXT', 'SinglesPleasures.com'); // text to place (image will not be used) 
 //Define('WATERMARK_TEXT_FONT', '4'); // font 1 / 2 / 3 / 4 / 5 
// Define('TEXT_SHADOW', '0'); // 1 - yes / 0 - no 
 //Define('TEXT_COLOR', '#FFFFFF'); // text color  


 // GENERAL SETTINGS 
 
Define('WATERMARK_ALIGN_H''right'); // left / right / center 
 
Define('WATERMARK_ALIGN_V''bottom'); // top / bottom / center 
 
Define('WATERMARK_MARGIN''0'); // margin 

// ---------------------------------------------------------------------------------------- 

$dr=preg_replace('/modify\.php.+/'''$_SERVER['PHP_SELF']); 
 
$filename=str_replace($dr'./'$_SERVER['PATH_INFO']); 

 
$lst=GetImageSize($filename); 
 
$image_width=$lst[0]; 
 
$image_height=$lst[1]; 
 
$image_format=$lst[2]; 

 if (
$image_format==1) { 
   
Header("Content-Type:image/gif"); 
   
readfile($filename); 
   exit; 
 } elseif (
$image_format==2) { 
  
$old_image=imagecreatefromjpeg($filename); 
 } elseif (
$image_format==3) { 
  
$old_image=imagecreatefrompng($filename); 
 } else { 
   
readfile($filename); 
   exit; 
 } 


 if (
Defined('WATERMARK_TEXT') && WATERMARK_TEXT!='' && ($image_height>192 || $image_width>192)) { 
 
// text 


  
$color eregi_replace("#",""TEXT_COLOR); 
  
$red hexdec(substr($color,0,2)); 
  
$green hexdec(substr($color,2,2)); 
  
$blue hexdec(substr($color,4,2)); 

  
$text_color imagecolorallocate ($old_image$red$green$blue);  

  
$text_height=imagefontheight(WATERMARK_TEXT_FONT); 
  
$text_width=strlen(WATERMARK_TEXT)*imagefontwidth(WATERMARK_TEXT_FONT); 
  
$wt_y=WATERMARK_MARGIN
  if (
WATERMARK_ALIGN_V=='top') { 
   
$wt_y=WATERMARK_MARGIN
  } elseif (
WATERMARK_ALIGN_V=='bottom') { 
   
$wt_y=$image_height-$text_height-WATERMARK_MARGIN
  } elseif (
WATERMARK_ALIGN_V=='center') { 
   
$wt_y=(int)($image_height/2-$text_height/2); 
  } 

  
$wt_x=WATERMARK_MARGIN
  if (
WATERMARK_ALIGN_H=='left') { 
   
$wt_x=WATERMARK_MARGIN
  } elseif (
WATERMARK_ALIGN_H=='right') { 
   
$wt_x=$image_width-$text_width-WATERMARK_MARGIN
  } elseif (
WATERMARK_ALIGN_H=='center') { 
   
$wt_x=(int)($image_width/2-$text_width/2); 
  } 

  if (
TEXT_SHADOW=='1') { 
   
imagestring($old_imageWATERMARK_TEXT_FONT$wt_x+1$wt_y+1WATERMARK_TEXT0); 
  } 
  
imagestring($old_imageWATERMARK_TEXT_FONT$wt_x$wt_yWATERMARK_TEXT$text_color); 

 }  
   if (
Defined('WATERMARK_IMAGE') && WATERMARK_IMAGE!='' && ($image_height>192 || $image_width>192)) { 
 
 
// image 


 
$lst2=GetImageSize(WATERMARK_IMAGE); 
 
$image2_width=$lst2[0]; 
 
$image2_height=$lst2[1]; 
 
$image2_format=$lst2[2]; 

 if (
$image2_format==2) { 
  
$wt_image=imagecreatefromjpeg(WATERMARK_IMAGE); 
 } elseif (
$image2_format==3) { 
  
$wt_image=imagecreatefrompng(WATERMARK_IMAGE); 
 } 

  if (
$wt_image) { 

   
$wt_y=WATERMARK_MARGIN
   if (
WATERMARK_ALIGN_V=='top') { 
    
$wt_y=WATERMARK_MARGIN
   } elseif (
WATERMARK_ALIGN_V=='bottom') { 
    
$wt_y=$image_height-$image2_height-WATERMARK_MARGIN
   } elseif (
WATERMARK_ALIGN_V=='center') { 
    
$wt_y=(int)($image_height/2-$image2_height/2); 
   } 

   
$wt_x=WATERMARK_MARGIN
   if (
WATERMARK_ALIGN_H=='left') { 
    
$wt_x=WATERMARK_MARGIN
   } elseif (
WATERMARK_ALIGN_H=='right') { 
    
$wt_x=$image_width-$image2_width-WATERMARK_MARGIN
   } elseif (
WATERMARK_ALIGN_H=='center') { 
    
$wt_x=(int)($image_width/2-$image2_width/2); 
   } 

   
imagecopymerge($old_image$wt_image$wt_x$wt_y00$image2_width$image2_heightWATERMARK_PERCENT); 
  } 

 } 

 if (
$image_format==2) { 
  
imageJpeg($old_image); 
 } 
 if (
$image_format==3) { 
  
imagePng($old_image); 
 } 


?>
ycpc55 is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 01-07-2007, 12:34 PM   #2 (permalink)
Inactive
 
Join Date: 12-23-06
Posts: 9
iTrader: 0 / 0%
Latest Blog:
None

ycpc55 is liked by many
Question

anyone know how this can be done?
ycpc55 is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-08-2007, 10:43 AM   #3 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,787
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
Send a message via Yahoo to Taltos
I didn't look very closely at the code but looking at the links, it looks like you are setting a very specific height and width for the location of the image. If the image doesn't fit right into that size then it stretches one way or another. If you have already looked at this and it is not the problem, I will try to take a longer look at the code.

Hope this helps, sorry if it is simple and you have already checked it.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Opaque Watermark n0numb3rs Coding Forum 5 05-29-2007 09:41 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:26 AM.
© Copyright 2008 V7 Inc