Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/05/2012, 19:35
marcofbb
Invitado
 
Mensajes: n/a
Puntos:
Respuesta: ¿Cómo guardo esta imagen?

Un usuario de forosdelweb creo este código:

Código PHP:
Ver original
  1. function save_img($image) {
  2.      
  3.     $img_file = file_get_contents($image);
  4.  
  5.     $image_path = parse_url($image);
  6.     $img_path_parts = pathinfo($image_path['path']);
  7.      
  8.     $filename = $img_path_parts['filename']
  9.     $img_ext = $img_path_parts['extension'];
  10.  
  11.     $path = "img/";
  12.     $filex = $path . $filename . "." .$img_ext;
  13.     $fh = fopen($filex, 'w');
  14.     fputs($fh, $img_file);
  15.     fclose($fh);
  16.     return filesize($filex);
  17. }


Asegurate que el " $path = "img/"; " existe en el servidor y que se escribible por el process de httpd

Si quieres usarlo puedes llamarlo de esta forma

Código PHP:
Ver original
  1. save_img("http://www.prueba.com/imagen.jpg")

http://www.forosdelweb.com/f18/guard...1/#post2562257

Saludos