Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/05/2014, 07:24
Samka
 
Fecha de Ingreso: mayo-2011
Ubicación: Entre Navarra y Aragón
Mensajes: 96
Antigüedad: 13 años
Puntos: 0
girar imagen con los datos exif

estoy intentando girar y subir una imagen al servidor dependiendo de sus datos exif mediante este código


Código PHP:
Ver original
  1. $tmp_name=$_FILES['image']['tmp_name'];      
  2.                                             $img_file=$_FILES['image']['name'];                      
  3.                                             $img_type=$_FILES['image']['type'];
  4.                                             $foto="../img/albumes/".$img_file;
  5.                                             if ((strpos($img_type,"jpeg") || strpos($img_type,"jpg"))){
  6.                                                 $exif = exif_read_data($_FILES['image']['tmp_name']);
  7.                                                 if(!empty($exif['Orientation'])) {
  8.                                                     switch($exif['Orientation']) {
  9.                                                         case 8:
  10.                                                             $image = imagecreatefromstring(file_get_contents($_FILES['image']['tmp_name']));
  11.                                                             $tmp_name = imagerotate($image,90,0);
  12.                                                             move_uploaded_file($tmp_name, "../img/albumes/".$img_file);  
  13.                                                             break;
  14.                                                         case 3:
  15.                                                             $image = imagecreatefromstring(file_get_contents($_FILES['image']['tmp_name']));
  16.                                                             $tmp_name = imagerotate($image,180,0);
  17.                                                             move_uploaded_file($tmp_name, "../img/albumes/".$img_file);
  18.                                                             break;
  19.                                                         case 6:
  20.                                                             $image = imagecreatefromstring(file_get_contents($_FILES['image']['tmp_name']));
  21.                                                             $tmp_name = imagerotate($image,-90,0);
  22.                                                             move_uploaded_file($tmp_name, "../img/albumes/".$img_file);
  23.                                                             break;
  24.                                                     }
  25.                                                 }
  26.                                                              
  27.                                             }

obviando lo optimo que es, de momento lo estoy probando y me salta el siguiente error

Código:
Warning: move_uploaded_file() expects parameter 1 to be string, resource given in...
aguna idea?