Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watermark #726

Closed
includebrasil opened this issue Dec 8, 2017 · 4 comments
Closed

watermark #726

includebrasil opened this issue Dec 8, 2017 · 4 comments

Comments

@includebrasil
Copy link

Hello, is it possible to insert a watermark in the gallery images?

@max-ci
Copy link

max-ci commented Dec 8, 2017

@includebrasil It's not possible only with lightGallery plugin. It has nothing to do with watermarks.

For that you can use for example watermark.js

@includebrasil
Copy link
Author

Do you know any examples of watermark.js with lightGallery? I'm trying to implement but I could not.

@sachinchoolur
Copy link
Owner

sachinchoolur commented Dec 9, 2017

Hey @includebrasil,

The following code works fine for me.

var noRendered = 0;
$('#lightgallery').children().each(function() {
    var $img = $(this);
    var imgurl = $(this).attr('data-src');
    watermark([imgurl, 'img/thumb-4.jpg'])
        .dataUrl(watermark.image.upperRight(1))
        .then(function(img) {
            noRendered++;
            $img.attr('data-src', img);
            if (noRendered === $('#lightgallery').children().length) {
                $('#lightgallery').lightGallery();
            }
        });
});

@includebrasil
Copy link
Author

includebrasil commented Dec 20, 2017

Hey @sachinchoolur,

Sorry for the delay!

Your code gave me a light. But unfortunately I could not implement!

This is my code snippet used in the gallery, how can I implement the code you passed me?

`
<script type="text/javascript">
$('#dynamic').on('click', function() {

$(this).lightGallery({
    autoplayControls: false,
    share: false,
    zoom: false,
    dynamic: true,        
    dynamicEl: [               
                <?php for($i = 0; $i < count($fotos); $i++){ ?>
                    {
                        "src": '<?php echo $sis_base['dominio'];?>/painel/subdominios/<?php echo $idsistema;?>/fotos/<?php echo $imovel['id_imovel']; ?>/<?php echo $fotos[$i];?>',
                        'thumb': '<?php echo $sis_base['dominio'];?>/painel/subdominios/<?php echo $idsistema;?>/fotos/<?php echo $imovel['id_imovel']; ?>/<?php echo "400_".$fotos[$i];?>',
                        'subHtml': '<h4><?php echo $fotos_legenda[$fotos[$i]]; ?><h4>'
                    },
                <?php } ?>
      ]})

});
      </script>`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants