Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
3 + 9 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: Is there a module to add a small logo of my site on the images of my articles?
by wishcraft on 2011/12/10 14:37:33

I made a thing called 'random.jpg' for outputting information. The HTACCESS looks like:

le="color: #000000"><?php RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^random.jpg index.php [L,NC,QSA]


The PHP for index.php which you would have to modify this code so you could do for example yoursite.com/images/watermark.jpg?image=/uploads/smartsection/yourimage.jpg to watermark the image. IT is using the framework WideImage to do its internal processes.

<?php @include ('../../mainfile.php'); @include $GLOBALS['xoops']->path('/Frameworks/wideimage/WideImage.php'); $GLOBALS['xoopsLogger']->activated = false; $dir = XOOPS_VAR_PATH."/images/erotica/"; $watermarkdir = XOOPS_VAR_PATH."/images/watermarks/erotica/"; $image = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (strpos(strtolower($file),".jpg")>0||strpos(strtolower($file),".gif")>0||strpos(strtolower($file),".png")>0) { $image[] = $file; } } closedir($dh); } } $watermarks = array(); if (is_dir($watermarkdir)) { if ($dh = opendir($watermarkdir)) { while (($file = readdir($dh)) !== false) { if (strpos(strtolower($file),".jpg")>0||strpos(strtolower($file),".gif")>0||strpos(strtolower($file),".png")>0) { $watermarks[] = $file; } } closedir($dh); } } if (sizeof($image)>0) { srand((((float)('0' . substr(microtime(), strpos(microtime(), ' ') + 1, strlen(microtime()) - strpos(microtime(), ' ') + 1))) * mt_rand(30, 99999))); srand((((float)('0' . substr(microtime(), strpos(microtime(), ' ') + 1, strlen(microtime()) - strpos(microtime(), ' ') + 1))) * mt_rand(30, 99999))); if (sizeof($watermarks)>0) { $which = mt_rand(0,sizeof($image)-1); $water = mt_rand(0,sizeof($watermarks)-1); error_reporting(E_ALL); $img = WideImage::load($dir.$image[$which]); $watermark = WideImage::load($watermarkdir.$watermarks[$water]); $wwidth = $watermark->getWidth(); $wheight = $watermark->getHeight(); if (isset($_GET['resize'])) { $resizeimg = $img->resize(intval($_GET['resize']).'%'); $resizeimg->output("JPG"); } elseif (isset($_GET['width'])&&isset($_GET['height'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); $imgb = $resizeimg->merge($watermark, sprintf("right - %s", $wwidth*(1/5)), sprintf("bottom - %s", $wheight*(1/5)), 75); } else { if ($width>intval($_GET['width'])&&$height>intval($_GET['height'])) { $resizeimg = $img->resize(intval($_GET['width']),intval($_GET['height']),'inside', 'down'); $imgb = $resizeimg->merge($watermark, sprintf("left + %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } else { $resizeimg = $img->resize(intval($_GET['width']),intval($_GET['height']),'inside', 'up'); $imgb = $resizeimg->merge($watermark, sprintf("left + %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } } $imgb->output("JPG"); exit(0); } elseif (isset($_GET['width'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize(NULL,$height* (intval($_GET['width'])/$width),'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); $imgb = $resizeimg->merge($watermark, sprintf("right - %s", $wwidth*(1/5)), sprintf("bottom - %s", $wheight*(1/5)), 75); } else { if ($width>intval($_GET['width'])) { $resizeimg = $img->resize(intval($_GET['width']),NULL,'inside', 'down'); $imgb = $resizeimg->merge($watermark, sprintf("left - %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } else { $resizeimg = $img->resize(intval($_GET['width']),NULL,'inside', 'up'); $imgb = $resizeimg->merge($watermark, sprintf("left + %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } } $imgb->output("JPG"); exit(0); } elseif (isset($_GET['height'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize($width* (intval($_GET['height'])/$height),NULL,'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); $imgb = $resizeimg->merge($watermark, sprintf("right - %s", $wwidth*(1/5)), sprintf("bottom - %s", $wheight*(1/5)), 75); } else { if ($height>intval($_GET['height'])) { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'down'); $imgb = $resizeimg->merge($watermark, sprintf("left + %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } else { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'up'); $imgb = $resizeimg->merge($watermark, sprintf("left + %s", mt_rand(5,25)), sprintf("top + %s", mt_rand(9,35)), 75); } } $imgb->output("JPG"); exit(0); } $img->output("JPG"); } else { $which = mt_rand(0,sizeof($image)); $img = WideImage::load($dir.$image[$which]); if (isset($_GET['resize'])) { $resizeimg = $img->resize(intval($_GET['resize']).'%'); $resizeimg->output("JPG"); } elseif (isset($_GET['width'])&&isset($_GET['height'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); } else { if ($width>intval($_GET['width'])&&$height>intval($_GET['height'])) { $resizeimg = $img->resize(intval($_GET['width']),intval($_GET['height']),'inside', 'down'); } else { $resizeimg = $img->resize(intval($_GET['width']),intval($_GET['height']),'inside', 'up'); } } $resizeimg->output("JPG"); exit(0); } elseif (isset($_GET['width'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize(NULL,$height* (intval($_GET['width'])/$width),'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); } else { if ($width>intval($_GET['width'])) { $resizeimg = $img->resize(intval($_GET['width']),NULL,'inside', 'down'); } else { $resizeimg = $img->resize(intval($_GET['width']),NULL,'inside', 'up'); } } $resizeimg->output("JPG"); exit(0); } elseif (isset($_GET['height'])) { $width = $img->getWidth(); $height = $img->getHeight(); if ($width>$height) { $resizeimg = $img->resize($width* (intval($_GET['height'])/$height),NULL,'inside', 'down')->crop("center", "middle", intval($_GET['width']), intval($_GET['height'])); } else { if ($height>intval($_GET['height'])) { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'down'); } else { $resizeimg = $img->resize(NULL,intval($_GET['height']),'inside', 'up'); } } $resizeimg->output("JPG"); exit(0); } $img->output("JPG"); } exit(0); } ?>


This would probably be the best way of watermarking your images is to have a path you call for it.
Re: Is there a module to add a small logo of my site on the images of my articles?
by Anonymous on 2011/12/10 11:18:30

The module extgallery has an option for automatically adding watermarks to uploaded pictures. But cannot be used to upload pictures directly from a content module...
Is there a module to add a small logo of my site on the images of my articles?
by karomaz on 2011/12/10 8:39:26

hi,

I want to know if there is a module so that my members can add images in the articles directly from their computer and not from an external link.

I also want to know if there is a module to add a logo to my website on the images of my articles to protect them (an watermark)


and thank you in advance ...

Who's Online

115 user(s) are online (88 user(s) are browsing Support Forums)


Members: 0


Guests: 115


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits