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.
The forum of the forums
5 posters

    Placement of the watermark image in the site.

    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

    In progress Placement of the watermark image in the site.

    Post by smurfavr 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);
    ?>
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

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

    Post by Ange Tuteur 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.
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

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

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

    what is this code suppose to do?
    avatar
    Worst Nightmare
    Forumember


    Posts : 107
    Reputation : 2
    Language : English

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

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

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


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

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

    Post by brandon_g 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. |
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

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


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

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

    up
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

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

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

    is this just for in topics?
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

    Post by smurfavr 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.
    brandon_g
    brandon_g
    Manager
    Manager


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

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

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

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


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

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

    Post by _Twisted_Mods_ 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
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

    Post by smurfavr 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?
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

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

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

    use css

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


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

    Post by smurfavr 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?
    _Twisted_Mods_
    _Twisted_Mods_
    Helper
    Helper


    Male Posts : 2083
    Reputation : 336
    Language : English
    Location : Ms

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

    Post by _Twisted_Mods_ 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)
    smurfavr
    smurfavr
    Active Poster


    Male Posts : 1881
    Reputation : 22
    Language : Bulgarian

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

    Post by smurfavr 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.

      Current date/time is November 12th 2024, 3:52 am