encrypt the html

Keawepoo

Joined: 2013-03-11
Posts: 4
Posted: Mon, 2013-03-11 23:54

is there a way to encrypt the html for no one can go into the code and look for the links to the images?? more so this part... people have been riping off my images, ive disabled right click, click and drag save, i know i cant stop screen shots. but i have a feeling there going into the code to rip the pics off.

thank you.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 00:23

I challenge you to find the image sources in this gallery.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Keawepoo

Joined: 2013-03-11
Posts: 4
Posted: Tue, 2013-03-12 02:46

soo umm how did u get it like that?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 03:55

in photo.html.php I replaced the <img /> w/ <canvas />

  <div id="g-photo">
    <?= $theme->resize_top($item) ?>
    <? if (access::can("view_full", $item)): ?>
    <a rel="file" href="#" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
      <? endif ?>
      <canvas id="<?= $item->id ?>" rel="resize" width="<?= $item->resize_width ?>" height="<?= $item->resize_height ?>"></canvas>
      <? if (access::can("view_full", $item)): ?>
    </a>
    <? endif ?>
    <?= $theme->resize_bottom($item) ?>
  </div>

in album.html.php same

    <a href="<?= $child->url() ?>">
      <? if ($child->has_thumb()): ?>
      <canvas id="<?= $child->id ?>" rel="thumb" width="<?= $child->thumb_width ?>" height="<?= $child->thumb_height ?>"></canvas>
      <? endif ?>
    </a>

then using the canvas id attribute I loaded our images via the REST interface so without a javascript console you'll never lay eyes on the source of the image.
As an added bonus I'm watermarking on the fly.
bottom of page.html.php:

<script>
  (function($) {
    // watermark
    var wtrMrk = new Image();
    wtrMrk.src = "http://url/to/my/watermark.png";
    wtrMrk.onload = function() {
      $('canvas').each(function() {
        var c = this;
        var asp = wtrMrk.height / wtrMrk.width;
        var w = c.width;
        var h = c.width * asp;
        var x = c.width / 2 - w / 2;
        var y = c.height / 2 - h / 2;
        var type = $(c).attr('rel') + '_url_public';
        var context = c.getContext('2d');
        $.ajax({
          url : '/gallery3/index.php/rest/item/' + $(c).attr('id'),
          data : {
            output : 'jsonp',
          },
          type : 'GET',
          dataType : 'jsonp',
          success : function(data) {
            var img = new Image();
            img.src = data.entity[type];
            img.onload = function() {
              context.drawImage(img, 0, 0);
              context.globalAlpha = 0.3;
              context.drawImage(wtrMrk, x, y, w, h);
              $(c).mouseover(function(e) {
                context.globalAlpha = 0.5;
                context.drawImage(wtrMrk, x, y, w, h);
              });
              var imageData = context.getImageData(0, 0, c.width, c.height);
              $(c).mouseout(function(e) {
                context.putImageData(imageData, 0, 0);
              });
              /*$(c.parentNode).unbind('click');
               $(c.parentNode).bind('click',function(e){
               e.preventDefault();
               location.href = this.href;
               });*/
            }
            if ($(c.parentNode).attr('rel') == 'file') {
              type = $(c.parentNode).attr('rel') + '_url_public';
              $('body').append($('<canvas />').attr({
                id : 'fullsize',
                width : data.entity.width,
                height : data.entity.height
              }).css({
                position : 'absolute',
                top : -9999,
                left : 0
              }));
              var f = document.getElementById('fullsize');
              var ws = data.entity.width;
              var hs = data.entity.width * asp;
              var xs = f.width / 2 - ws / 2;
              var ys = f.height / 2 - hs / 2;
              var contexts = f.getContext('2d');
              var imgs = new Image();
              imgs.src = data.entity[type];
              imgs.onload = function() {
                contexts.drawImage(imgs, 0, 0);
                contexts.globalAlpha = 0.5;
                contexts.drawImage(wtrMrk, xs, ys, ws, hs);
                $(c.parentNode).attr({
                  href : f.toDataURL("image/jpeg")
                });
              }
            }
          }
        });

      });
    }
  })(this.jQuery);
</script>

Just something I whipped up.

But to answer your original question:

Quote:
is there a way to encrypt the html

No.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Mr. B

Joined: 2005-10-09
Posts: 25
Posted: Tue, 2013-03-12 05:28

Chrome. Done.

http://i.imgur.com/etFyZ04.jpg

If you don't want people "downloading" your pictures, don't put them on the Internet. Viewing = downloading.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 05:35

@Mr. B
So what's that?
you used your JS console to see the rest url?

Point here is.. that the average troll cannot get that. and it even makes it fairly hard for mid-advanced image thieves.

But YES visible on the internet === Stolen

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Mr. B

Joined: 2005-10-09
Posts: 25
Posted: Tue, 2013-03-12 05:42

Right click > Inspect element. "Developer tools" are built into the browser. Easy as pie.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 05:45

Exactly... visible on the internet === Stolen

Anyone who really wants to see your s@^t will.

My solution requires a javascript console to steal.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Mr. B

Joined: 2005-10-09
Posts: 25
Posted: Tue, 2013-03-12 05:47

The most realistic solution would be to embed the watermark in the actual JPG file, something you can do on export in Lightroom.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 05:54

actually both gallery2 and gallery3 can build resizes and thumbs w/ a watemark - no need for the overpriced Lightroom.

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Keawepoo

Joined: 2013-03-11
Posts: 4
Posted: Tue, 2013-03-12 18:59

i get LR for free :) from my school. but i also have wartermark on my images but ppl crop them out of it. -_- what do you mean by "REST interface"??

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2013-03-12 22:47
Quote:
what do you mean by "REST interface"??

Gallery's REST module

-s
________________________________
All New jQuery Minislideshow for G2/G3

 
Keawepoo

Joined: 2013-03-11
Posts: 4
Posted: Tue, 2013-03-19 22:52

how do i get to the reset module?? because there isnt any when im looking at the module page...

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2013-03-19 23:05