The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Placement of the watermark image in the site.

View previous topic View next topic Go down

In progress Placement of the watermark image in the site.

Post by smurfavr on February 21st 2015, 11:11 am

Where to put this code to work in my forum?

Code:
<?php
 
$main_img        = "YourMainPicture.jpg"; // главното изображение
$watermark_img    = "watermark.gif"; // Изображението , което се използва за воден знак . Използвайте GIF или PNG, JPEG няма подръжка на прозрачност
$padding        = 3; // разстоянието до border в пиксели за изображението на водния знак
$opacity        = 100;    // прозрачността на водния знак
 
$watermark    = imagecreatefromgif($watermark_img); // прави водния знак
$image        = imagecreatefromjpeg($main_img); // прави главното изображение
 
if(!$image || !$watermark) die("Error: main image or watermark could not be loaded!");
 
 
$watermark_size    = getimagesize($watermark_img);
$watermark_width    = $watermark_size[0];
$watermark_height    = $watermark_size[1];
 
$image_size    = getimagesize($main_img);
$dest_x        = $image_size[0] - $watermark_width - $padding;
$dest_y        = $image_size[1] - $watermark_height - $padding;
 
 
// копира водния знак и го поставя в главното изображение
imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $opacity);
 
 
// изкарва изображението
header("content-type: image/jpeg");
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);
?>

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by Ange Tuteur on February 22nd 2015, 2:25 am

Hi @smurfavr,

That's a PHP file, so unfortunately you wont be able to install it anywhere in the administration panel.

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by _Twisted_Mods_ on February 22nd 2015, 2:56 am

what is this code suppose to do?

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by Worst Nightmare on February 22nd 2015, 3:36 am

How can i add watermark on my forum, i tried everything and it didnt work

Worst Nightmare
Forumember

Posts : 107
Reputation : 2
Language : English

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by brandon_g on February 22nd 2015, 4:13 am

@Ange Tuteur wrote:Hi @smurfavr,

That's a PHP file, so unfortunately you wont be able to install it anywhere in the administration panel.

@_Twisted_Mods_ wrote:what is this code suppose to do?
If you read the above posts you would see the code wont work because its a php. That would explain why didnt work. |

brandon_g
Support Moderator
Support Moderator

Male Posts : 5140
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 22nd 2015, 1:06 pm

Can anybody give a similar code that will work on my site.

psp
This code that will happen?
http://www.patrick-wied.at/static/watermarkjs/


Or this.
Javascript
Code:
function watermark(inputId,text){
  var inputBox = document.getElementById(inputId);
    if (inputBox.value.length > 0){
      if (inputBox.value == text)
        inputBox.value = '';
    }
    else
      inputBox.value = text;
}

HTML:
Code:
<input id="inputTextboxId" type="text" value="type here" onfocus="watermark('inputTextboxId','type here');" onblur="watermark('inputTextboxId','type here');" />


Last edited by smurfavr on February 23rd 2015, 9:39 pm; edited 1 time in total

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 25th 2015, 12:14 pm

up

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by _Twisted_Mods_ on February 25th 2015, 12:21 pm

is this just for in topics?

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 25th 2015, 12:23 pm

@_Twisted_Mods_ wrote:is this just for in topics?
I did not understand what you're saying. I use gogle translator.

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by brandon_g on February 25th 2015, 12:40 pm

Do you only want it to show when someone is reading a topic?


Remember to mark your topic when a solution is found.

brandon_g
Support Moderator
Support Moderator

Male Posts : 5140
Reputation : 478
Language : English
Location : USA

http://broadcastingduo.forumotion.com/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by _Twisted_Mods_ on February 25th 2015, 1:10 pm

k this work on phpbb2 in topics only


goto acp>modules>javascript management

create a new script

title:Your Choice
Placement: in topics
copy and paste the code below then save

Code:
$(function(){
   $('.post .postbody img').each(function(index){
      var imgurl = 'https://www.filepicker.io/api/file/wTmT0TT6ELnUrZ1SwyYC+copyrights.png';
      var height = $(this).height();
var position = $(this).position();
      var width = $(this).width();
      $(this).wrap('<div id="imgwrap" style="display: inline-block;position: relative;height:'+height+';width:'+width+'"></div>').parent().append('<span id="imgoverlay" style="background-image:url('+imgurl+'); position:absolute;height:100%;width:100%;left:0px;top:0px">');
   });
});


you can change the url in imgurl to what ever image you would like for the copyright

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 25th 2015, 2:03 pm

Image has a lot of watermarks. How to do it to show only one watermark? How can I change the place where to be, watermark?

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by _Twisted_Mods_ on February 25th 2015, 4:01 pm

use css

Code:
#imgoverlay{
background-repeat:no-repeat;
background-position: 50% 50%
}

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 25th 2015, 6:46 pm

How can I change the place where to be, watermark?Can you image the code should be replaced with text that can be changed?

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by _Twisted_Mods_ on February 25th 2015, 10:02 pm

yea u can use this one for text

Code:

$(function () {
  $('.post .postbody img').each(function (index) {
    var text = '� CopyRight';
    var color = 'rgba(255,255,255,0.2)';
    var fontsize = '14px';
    var position = 'center';
    var height = $(this).height();
    var top = height / 2;
    var width = $(this).width();
    $(this).wrap('<div id="imgwrap" style=";display: inline-block;position: relative;height:' + height + 'px;width:' + width + 'px"></div>').parent().append('<span id="imgoverlay" style="font-size:' + fontsize + ';color:' + color + ';text-align:' + position + ';margin-left:5px;position:absolute;height:' + height + 'px;width:' + (width - 10) + 'px;left:0px;top:' + top + 'px">'+text+'</span>');
  });
});


var text = '� CopyRight'; << this is the text that will overlay the images
var color = 'rgba(255,255,255,0.2)'; << font color with 0.2 transparency
var fontsize = '14px'; << font size
var position = 'center'; << text align (left,right,center)

_Twisted_Mods_
Helper
Helper

Male Posts : 2020
Reputation : 299
Language : English
Location : Ms

http://liquidcode.forumotion.com

Back to top Go down

In progress Re: Placement of the watermark image in the site.

Post by smurfavr on February 25th 2015, 11:06 pm

Can be done watermark remains in the picture when some copy it from my website.Can the inscription of the image is always placed in the lower right corner of the photo.

smurfavr
Active Poster

Male Posts : 1384
Reputation : 9
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum