The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Placement of the watermark image in the site.

5 posters

Go down

In progress Placement of the watermark image in the site.

Post by smurfavr Sat 21 Feb - 6:11

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
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
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 Sat 21 Feb - 21:25

Hi @smurfavr,

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

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

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

Post by _Twisted_Mods_ Sat 21 Feb - 21:56

what is this code suppose to do?
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 Sat 21 Feb - 22:36

How can i add watermark on my forum, i tried everything and it didnt work
avatar
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 Sat 21 Feb - 23:13

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
brandon_g
Manager
Manager

Male Posts : 10113
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

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

Post by smurfavr Sun 22 Feb - 8:06

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 Mon 23 Feb - 16:39; edited 1 time in total
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
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 Wed 25 Feb - 7:14

up
smurfavr
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
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_ Wed 25 Feb - 7:21

is this just for in topics?
_Twisted_Mods_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 Wed 25 Feb - 7:23

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

Male Posts : 1881
Reputation : 22
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 Wed 25 Feb - 7:40

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


Placement of the watermark image in the site. Brando10
Remember to mark your topic Placement of the watermark image in the site. Solved15 when a solution is found.
General Rules | Tips & Tricks | FAQ | Forgot Founder Password?

Placement of the watermark image in the site. Scre1476
Team Leader
Review Section Rules | Request A Review | Sticker Points
brandon_g
brandon_g
Manager
Manager

Male Posts : 10113
Reputation : 923
Language : English
Location : USA

https://www.broadcastingduo.com

Back to top Go down

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

Post by _Twisted_Mods_ Wed 25 Feb - 8:10

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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 Wed 25 Feb - 9:03

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
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
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_ Wed 25 Feb - 11:01

use css

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

Male Posts : 2083
Reputation : 336
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 Wed 25 Feb - 13:46

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
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
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_ Wed 25 Feb - 17:02

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_
_Twisted_Mods_
Helper
Helper

Male Posts : 2083
Reputation : 336
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 Wed 25 Feb - 18:06

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
smurfavr
Active Poster

Male Posts : 1881
Reputation : 22
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Back to top

- Similar topics

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