علی زینلی 2114 ارسال شده در آذر 93 گزارش بازنشر ارسال شده در آذر 93 سلام به تمامی دوستان.از منبع:http://dolcepixel.com/how-to-watermark-all-your-uploaded-images/برای گذاشتن واترمارک خودکار روی عکسام استفاده کردممحتوای فایل httaccess# BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]RewriteRule (.*)wp-content/uploads/(.*\.(jpe?g|gif|png))$ $1watermark.php?p=br&q=90&src=wp-content/uploads/$2</IfModule># END WordPressهمچنین محتوای فایل watermark.php:<?phpheader('Content-type: image/jpeg');$img = $_GET['src'];$p = $_GET['p']; if(!$p) $p = 'br';/*p can be anything from the following list:tl = top lefttc = top centertr = top rightcl = center leftc = center of the imagecr = center rightbl = bottom leftbc = bottom centerbr = bottom right*///watermarked image quality$q = $_GET['q'];//if the quality field is missing or is not on the 0 to 100 scale then we set the quality to 93if(!$q || $q<0 || $q>100) $q = '100';$filetype = substr($img,strlen($img)-4,4);$filetype = strtolower($filetype);if($filetype == ".gif") $image = @imagecreatefromgif($img);if($filetype == ".jpg") $image = @imagecreatefromjpeg($img);if($filetype == ".png") $image = @imagecreatefrompng($img);if (!$image) die();//getting the image size for the original image$img_w = imagesx($image);$img_h = imagesy($image);//if the filename has 150x150 in it's name then we don't apply the watermarkif (eregi("150x150", $img)) { imagejpeg($image, null, $q); die();} else { $watermark = @imagecreatefrompng('watermark.png');}/*//if you want to use the watermark only on bigger images then use this instead of the condition aboveif ($img_w < "150") {//if image width is less then 150 pixels imagejpeg($image, null, $q); die();} else { $watermark = @imagecreatefrompng('watermark.png');}*///getting the image size for the watermark$w_w = imagesx($watermark);$w_h = imagesy($watermark);if($p == "tl") { $dest_x = 0; $dest_y = 0;} elseif ($p == "tc") { $dest_x = ($img_w - $w_w)/2; $dest_y = 0;} elseif ($p == "tr") { $dest_x = $img_w - $w_w; $dest_y = 0;} elseif ($p == "cl") { $dest_x = 0; $dest_y = ($img_h - $w_h)/2;} elseif ($p == "c") { $dest_x = ($img_w - $w_w)/2; $dest_y = ($img_h - $w_h)/2;} elseif ($p == "cr") { $dest_x = $img_w - $w_w; $dest_y = ($img_h - $w_h)/2;} elseif ($p == "bl") { $dest_x = 0; $dest_y = $img_h - $w_h;} elseif ($p == "bc") { $dest_x = ($img_w - $w_w)/2; $dest_y = $img_h - $w_h;} elseif ($p == "br") { $dest_x = $img_w - $w_w; $dest_y = $img_h - $w_h;}imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $w_w, $w_h);imagejpeg($image, null, $q);imagedestroy($image);imagedestroy($watermark);?>اطلاعات:1:گالری بر روی ساب دامنه هست (محتوی ها رو همه رو توی پوشه همون ساب دامین گذاشتم)2:تصاویر بر روی هاست دانلود (یه هاست دیگه) آپلود میشن3:در پایان هر آپلود با ارور]: Cannot set time limit in safe mode in /home/MySiteName/public_html/gallery/wp-content/plugins/upload-to-ftp/upload-to-ftp.php on line 253212مواجه میشم4: برای آپلود تصاویر همونطور که دیدید از افزونه upload to ftp استفاده میکنم و برای نمایش تصاویر شاخص از افزونه ی hacklong remote attachment____________اگر هر روش دیگه ای برای آپلود عکس (که بهتر باشه) ، یا واترمارک یاد دارین خوشحال میشم بهم بگین.اگر هم مشکل بالا حل شد که چه بهتر... 1 نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .