PHP - subida de imagenes masivas

 
Vista:
Imágen de perfil de rafa

subida de imagenes masivas

Publicado por rafa (12 intervenciones) el 19/10/2016 17:54:21
Muy buenas a todos.
Agradeceria muchisimo si alguien podria ayudarme con este problemita dado que es algo fuera de lo común.

Estamos realizando un proyecto de alquiler de viviendas,
hemos realizado un script el cual hace subida masiva de imagenes al servidor y a la vez la reescala a un tamaño en concreto, la verdad funciona perfectamente con android pero tenemos el problema que a la hora de subir imagen a la web con un iphone la imagen aparece rotada. ¿podria alguien decirme si esto puede ser por problemas de codigo o bien por configuracion del iphone.?

Espero respuesta muchisimas gracias.
de todas formas aqui dejo el script suibda de archivos escalables

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
55
56
57
58
59
function scaleImageFileToBlob($file) {
 
    $source_pic = $file;
    $max_width = 300;
    $max_height = 200;
 
    list($width, $height, $image_type) = getimagesize($file);
 
    switch ($image_type)
    {
        case 1: $src = imagecreatefromgif($file); break;
        case 2: $src = imagecreatefromjpeg($file);  break;
        case 3: $src = imagecreatefrompng($file); break;
        default: return '';  break;
    }
 
    $x_ratio = $max_width / $width;
    $y_ratio = $max_height / $height;
 
    if( ($width <= $max_width) && ($height <= $max_height) ){
        $tn_width = $width;
        $tn_height = $height;
        }elseif (($x_ratio * $height) < $max_height){
            $tn_height = ceil($x_ratio * $height);
            $tn_width = $max_width;
        }else{
            $tn_width = ceil($y_ratio * $width);
            $tn_height = $max_height;
    }
 
    $tmp = imagecreatetruecolor($tn_width,$tn_height);
 
    /* Check if this image is PNG or GIF, then set if Transparent*/
    if(($image_type == 1) OR ($image_type==3))
    {
        imagealphablending($tmp, false);
        imagesavealpha($tmp,true);
        $transparent = imagecolorallocatealpha($tmp, 255, 255, 255, 127);
        imagefilledrectangle($tmp, 0, 0, $tn_width, $tn_height, $transparent);
    }
    imagecopyresampled($tmp,$src,0,0,0,0,$tn_width, $tn_height,$width,$height);
 
    /*
     * imageXXX() only has two options, save as a file, or send to the browser.
     * It does not provide you the oppurtunity to manipulate the final GIF/JPG/PNG file stream
     * So I start the output buffering, use imageXXX() to output the data stream to the browser,
     * get the contents of the stream, and use clean to silently discard the buffered contents.
     */
    ob_start();
 
    switch ($image_type)
    {
        case 1: imagegif($tmp, $file); break;
        case 2: imagejpeg($tmp, $file, 95);  break; // best quality
        case 3: imagepng($tmp, $file, 0); break; // no compression
        default: echo ''; break;
    }
    ob_end_clean();
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

subida de imagenes masivas

Publicado por exe (1 intervención) el 27/12/2017 22:07:35
Hola, pudiste solucionar ese problema? Si es así, me cuentas como?

Saludos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar