Author Topic: space.gif en Javascript proteger las fotos de bajadas indeseables  (Read 9924 times)

0 Members and 1 Guest are viewing this topic.

Offline TRISKO

  • Newbie
  • *
  • Posts: 24
    • View Profile
Muy Buenas  en el archivo jpg.html en la carpeta media tengo lo siguiente :

<!-- Template file for JPG Files -->
<img src="{media_src}" border="1" alt="{image_name}" id="imgid{image_id}"{width_height} /><br />
<script language="JavaScript" type="text/javascript">
  function get_id(id)
  {
    if (document.getElementById) return document.getElementById(id);
    if (document.all && !document.getElementById) return document.all[id];
    if (document.layers) return document.layers[id];
  }
  function image_size(){
    objImage = new Image();
    objImage.onload = function ch(){resize(this.width, this.height)};
    objImage.src = "{media_src}";
  }
  function resize(width, height)
  {
    var AspectRatio, FinalWidth, FinalHeight, DoResize;
    DoResize=0;
    FinalWidth = width;
    FinalHeight = height;
    if (screen.width < 1601)
    {
      FinalWidth = 768; DoResize=1;
    }
    if (screen.width < 800)
    {
      FinalWidth = 480; DoResize=1;
    }
    if (DoResize)
    {
      if (width > height)
      {
        AspectRatio = (width / height);
        FinalHeight = FinalWidth/AspectRatio;
      }
      if (width < height)
      {
        AspectRatio = height / width;
        FinalHeight = FinalWidth;
        FinalWidth = FinalHeight/AspectRatio;
      }
    }
    get_id("imgid{image_id}").width = FinalWidth;
    get_id("imgid{image_id}").height = FinalHeight;
  }
  image_size();
</script>

Con este script consigo que al pinchar en los tmubnails  aparezca la foto original pero se redimensiona perfectamente en la pantalla  sin descuadrarse, este script lo copie de este foro , es la leche funciona perfectamente.

Pero ahí va mi pregunta  como puedo aplicar  el space.gif en este script.

El space.gif es crear una imagen gif transparente y ponerla en la carpeta images y según la ruta que le pongas la persona que intenta copiarte una foto , lo que copia es esta imagen gif y no la foto original.

Muchas Gracias por todo a todos este foro es genial

Un saludo

Igancio

Offline excitex2

  • Addicted member
  • ******
  • Posts: 1.590
  • He desactivado la galería y el buscador
    • View Profile
Re: space.gif en Javascript proteger las fotos de bajadas indeseables
« Reply #1 on: October 14, 2006, 10:02:16 PM »
Saludos,,,

Intentalo asi,,, :

Code: [Select]
<!-- Template file for JPG Files -->
<table style="background: url('{media_src}') no-repeat center; " cellpadding="{width_height}" cellspacing="{width_height}">
  <tr>
    <td>{link_back}<img src="{template_url}/images/spacer.gif" border="1" alt="{image_name}" id="imgid{image_id}"{width_height} /></a>{link_back_end}</td>
  </tr>
</table>


<script language="JavaScript" type="text/javascript">
  function get_id(id)
  {
    if (document.getElementById) return document.getElementById(id);
    if (document.all && !document.getElementById) return document.all[id];
    if (document.layers) return document.layers[id];
  }
  function image_size(){
    objImage = new Image();
    objImage.onload = function ch(){resize(this.width, this.height)};
    objImage.src = "{media_src}";
  }
  function resize(width, height)
  {
    var AspectRatio, FinalWidth, FinalHeight, DoResize;
    DoResize=0;
    FinalWidth = width;
    FinalHeight = height;
    if (screen.width < 1601)
    {
      FinalWidth = 768; DoResize=1;
    }
    if (screen.width < 800)
    {
      FinalWidth = 480; DoResize=1;
    }
    if (DoResize)
    {
      if (width > height)
      {
        AspectRatio = (width / height);
        FinalHeight = FinalWidth/AspectRatio;
      }
      if (width < height)
      {
        AspectRatio = height / width;
        FinalHeight = FinalWidth;
        FinalWidth = FinalHeight/AspectRatio;
      }
    }
    get_id("imgid{image_id}").width = FinalWidth;
    get_id("imgid{image_id}").height = FinalHeight;
  }
  image_size();
</script>

excitex2
Lo importante no es saber,,, lo importante es tener el E-Mail de quien sabe

Offline TRISKO

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: space.gif en Javascript proteger las fotos de bajadas indeseables
« Reply #2 on: October 15, 2006, 02:46:37 PM »
Muchisimas Gracias por contestar tan pronto que bien  :D :D :D :D :D :D :D


Acabo de probarlo y la imagen se muestra pero no se redimensiona bien

De todas formas gracias por intentarlo

Un saludo

Ignacio

Offline TRISKO

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: space.gif en Javascript proteger las fotos de bajadas indeseables
« Reply #3 on: October 16, 2006, 05:29:27 PM »
i know to put the word spacer.gif  not space.gif

I tried to do this

Ihope to works

Thanks
Ignacio

Offline TRISKO

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: space.gif en Javascript proteger las fotos de bajadas indeseables
« Reply #4 on: October 16, 2006, 05:31:44 PM »
He cambiado las palabras y sigue sin funcionar

Bueno si alguien sabria corregir el codigo con el Space.gif  se lo agradecería un montón

Gracias a todos

Este foro es superior

Un saludo

Ignacio