PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old January 14th, 2007, 08:40 AM
ycpc55 ycpc55 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 ycpc55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 stretch thanks....

link 1:
http://www.singlespleasures.com/member/index.php?pag=member_profile&member_id=280

link 2:
http://www.singlespleasures.com/member/index.php?pag=member_profile&member_id=3
php code:
php Code:
Original - php Code
  1. <?
  2.  
  3.  
  4. // IMAGE WATERMARK (comment line below if you do not want to use image watermark)
  5. Define('WATERMARK_IMAGE', './wt.png'); // path to watermark image
  6. Define('WATERMARK_PERCENT', '100'); // Intensity of the transition (in percent)
  7.  
  8.  
  9. // TEXT WATERMARK (comment line below if you do not want to use text)
  10. //Define('WATERMARK_TEXT', 'SinglesPleasures.com'); // text to place (image will not be used)
  11. //Define('WATERMARK_TEXT_FONT', '4'); // font 1 / 2 / 3 / 4 / 5
  12. // Define('TEXT_SHADOW', '0'); // 1 - yes / 0 - no
  13. //Define('TEXT_COLOR', '#FFFFFF'); // text color
  14.  
  15.  
  16. // GENERAL SETTINGS
  17. Define('WATERMARK_ALIGN_H', 'right'); // left / right / center
  18. Define('WATERMARK_ALIGN_V', 'bottom'); // top / bottom / center
  19. Define('WATERMARK_MARGIN', '0'); // margin
  20.  
  21. // ----------------------------------------------------------------------------------------
  22.  
  23. $dr=preg_replace('/modify.php.+/', '', $_SERVER['PHP_SELF']);
  24. $filename=str_replace($dr, './', $_SERVER['PATH_INFO']);
  25.  
  26. $lst=GetImageSize($filename);
  27. $image_width=$lst[0];
  28. $image_height=$lst[1];
  29. $image_format=$lst[2];
  30.  
  31. if ($image_format==1) {
  32. Header("Content-Type:image/gif");
  33. readfile($filename);
  34. } elseif ($image_format==2) {
  35. $old_image=imagecreatefromjpeg($filename);
  36. } elseif ($image_format==3) {
  37. $old_image=imagecreatefrompng($filename);
  38. } else {
  39. readfile($filename);
  40. }
  41.  
  42.  
  43. if (Defined('WATERMARK_TEXT') && WATERMARK_TEXT!='' && ($image_height>192 || $image_width>192)) {
  44. // text
  45.  
  46.  
  47. $color = eregi_replace("#","", TEXT_COLOR);
  48. $red = hexdec(substr($color,0,2));
  49. $green = hexdec(substr($color,2,2));
  50. $blue = hexdec(substr($color,4,2));
  51.  
  52. $text_color = imagecolorallocate ($old_image, $red, $green, $blue);
  53.  
  54. $text_height=imagefontheight(WATERMARK_TEXT_FONT)
  55. $text_width=strlen(WATERMARK_TEXT)*imagefontwidth(  WATERMARK_TEXT_FONT);
  56. $wt_y=WATERMARK_MARGIN;
  57. if (WATERMARK_ALIGN_V=='top') {
  58. $wt_y=WATERMARK_MARGIN;
  59. } elseif (WATERMARK_ALIGN_V=='bottom') {
  60. $wt_y=$image_height-$text_height-WATERMARK_MARGIN;
  61. } elseif (WATERMARK_ALIGN_V=='center') {
  62. $wt_y=(int)($image_height/2-$text_height/2);
  63. }
  64.  
  65. $wt_x=WATERMARK_MARGIN;
  66. if (WATERMARK_ALIGN_H=='left') {
  67. $wt_x=WATERMARK_MARGIN;
  68. } elseif (WATERMARK_ALIGN_H=='right') {
  69. $wt_x=$image_width-$text_width-WATERMARK_MARGIN;
  70. } elseif (WATERMARK_ALIGN_H=='center') {
  71. $wt_x=(int)($image_width/2-$text_width/2);
  72. }
  73.  
  74. if (TEXT_SHADOW=='1') {
  75. imagestring($old_image, WATERMARK_TEXT_FONT, $wt_x+1, $wt_y+1, WATERMARK_TEXT, 0);
  76. }
  77. imagestring($old_image, WATERMARK_TEXT_FONT, $wt_x, $wt_y, WATERMARK_TEXT, $text_color);
  78.  
  79. }
  80. if (Defined('WATERMARK_IMAGE') && WATERMARK_IMAGE!='' && ($image_height>192 || $image_width>192)) {
  81.  
  82. // image
  83.  
  84.  
  85. $lst2=GetImageSize(WATERMARK_IMAGE);
  86. $image2_width=$lst2[0];
  87. $image2_height=$lst2[1];
  88. $image2_format=$lst2[2];
  89.  
  90. if ($image2_format==2) {
  91. $wt_image=imagecreatefromjpeg(WATERMARK_IMAGE);
  92. } elseif ($image2_format==3) {
  93. $wt_image=imagecreatefrompng(WATERMARK_IMAGE);
  94. }
  95.  
  96. if ($wt_image) {
  97.  
  98. $wt_y=WATERMARK_MARGIN;
  99. if (WATERMARK_ALIGN_V=='top') {
  100. $wt_y=WATERMARK_MARGIN;
  101. } elseif (WATERMARK_ALIGN_V=='bottom') {
  102. $wt_y=$image_height-$image2_height-WATERMARK_MARGIN;
  103. } elseif (WATERMARK_ALIGN_V=='center') {
  104. $wt_y=(int)($image_height/2-$image2_height/2);
  105. }
  106.  
  107. $wt_x=WATERMARK_MARGIN;
  108. if (WATERMARK_ALIGN_H=='left') {
  109. $wt_x=WATERMARK_MARGIN;
  110. } elseif (WATERMARK_ALIGN_H=='right') {
  111. $wt_x=$image_width-$image2_width-WATERMARK_MARGIN;
  112. } elseif (WATERMARK_ALIGN_H=='center') {
  113. $wt_x=(int)($image_width/2-$image2_width/2);
  114. }
  115.  
  116. imagecopymerge($old_image, $wt_image, $wt_x, $wt_y, 0, 0, $image2_width, $image2_height, WATERMARK_PERCENT);
  117. }
  118.  
  119. }
  120.  
  121. if ($image_format==2) {
  122. imageJpeg($old_image);
  123. }
  124. if ($image_format==3) {
  125. imagePng($old_image);
  126. }
  127.  
  128.  
  129. ?>





Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > watermark png no resize


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway