Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/09/2007, 15:04
Avatar de razengan
razengan
 
Fecha de Ingreso: agosto-2007
Ubicación: Lima - Perulandia
Mensajes: 117
Antigüedad: 16 años, 8 meses
Puntos: 2
Pregunta Redimencioandor de imagenes externa

hola tengo este script :

en el index.php se muestra la imagen
Cita:
<img src='redimensionar.php?imagen=1.jpg'>
y este es el codigo en redimencionar.php

Cita:
<?php
$anchura=180;
$hmax=180;
$nombre=basename($_GET['imagen']);
$datos = getimagesize($nombre);
if($datos[2]==1){$img = @imagecreatefromgif($nombre);}
if($datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
if($datos[2]==3){$img = @imagecreatefrompng($nombre);}
$ratio = ($datos[0] / $anchura);
$altura = ($datos[1] / $ratio);
if($altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
$thumb = imagecreatetruecolor($anchura,$altura);
imagecopyresampled($thumb, $img, 0, 0, 0, 0, $anchura, $altura, $datos[0], $datos[1]);
if($datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
if($datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
if($datos[2]==3){header("Content-type: image/png");imagepng($thumb); }
imagedestroy($thumb);
?>
Ok todo bien hasta ahi claro que la imagen esta alojada en mi server el problema viene cuando pongo una imagen externa


Cita:
<img src='redimensionar.php?imagen=http://www.google.com.pe/intl/en_com/
images/logo_plain.png'>
El problema radica en este script no funciona con imagenes externas !

que puedo hacer espero su ayuda . gracias

Última edición por razengan; 12/09/2007 a las 18:53