En esta ocasión tendremos otro código para hacer que el usuario que accede a google imágenes acceda a nuestro sitio. Necesitamos .htaccess + PHP con GD.
A diferencia de el primer hack que usaba una función de PHP para colocar un texto lo que haremos es colocar una imagen PNG transparente arriba de la imagen con una calidad bastante baja (funciona mucho mas rápido que el primer código).
Ejemplo:
Otra diferencia con el 1 hack, es que este funciona con cualquier tamaño de imagen, sea cual sea siempre se lee el texto 🙂
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <?php set_time_limit(0); //Cargamos la imagen $img2 = str_replace(' ','+',$_GET['img']); //Fondo a usar $img = 'fondo.png'; //Cabezeras header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header('Content-Type: image/jpeg'); //Obtenemos los datos de la imagen list($width, $height, $type, $attr) = getimagesize($img2); if($width<=0){ //si no obtenemos ningun dato cargamos solo el fondo $dstimage = imagecreatefrompng($img); imagejpeg($dstimage,null,20); imagedestroy($dstimage); die(); } //Vemos la extencion $filetype = substr($img2,strlen($img2)-4,4); $filetype = strtolower($filetype); if($filetype == ".gif") $image = @imagecreatefromgif($img2); if($filetype == ".jpg" || $filetype == ".jpe") $image = @imagecreatefromjpeg($img2); if($filetype == ".jpe") $image = @imagecreatefromjpeg($img2); if($filetype == ".png") $image = @imagecreatefrompng($img2); if (!$image) die(); $dstimage = $image; //Cargamos el fondo en memoria $srcimage = imagecreatefrompng($img); //codigo para no perder la transparencia imagealphablending($srcimage, false); imagesavealpha($srcimage, true); imagecolortransparent($srcimage, imagecolorallocatealpha($srcimage, 0, 0, 0, 127)); //Copiamos el fondo a la imagen imagecopyresampled($dstimage,$srcimage,0,0,0,0, $width,$height,300,300); imagealphablending($dstimage, true); //creamos una imagen con calidad 20 (de 0 a 100) imagejpeg($dstimage,null,20); //Vaciamos memoria imagedestroy($dstimage); imagedestroy($srcimage); ?> |
2 comentarios en “Hack 4 – Google Imagenes”