I am using Symfony2 and I have a problem with the PHP:getimagesize because sometime the dimensions that this function return are exchanged.
My use of this function is like int the http://php.net/manual/es/function.getimagesize.php page and the images are sent to the server with a POST;
I post a mwe :
//INITIALIZATION OF VARIABLES
for ($i = 0; $i < count($_FILES['filename']['tmp_name']); $i++) {
if ($_FILES['filename']['tmp_name'][$i]) {
$img = strtolower(strtotime(date('Y-m-d h:i:s')) . $random . ".jpg");
if (!is_dir($Tmppath)) {
mkdir($Tmppath, 0777, TRUE);
}
move_uploaded_file($_FILES['filename']['tmp_name'][$i], $Tmppath . $img);
if (file_exists($Tmppath . $img)) {
if (!empty($img)) {
//DO SOMEHTING
list($width, $height) = getimagesize($Tmppath . $img);
//DO SOMEHTING
}
}
}
}
But sometime the $width and $height of the image are exchanged; the images that are uploaded from the clients are of many format and sometime if the same image that is uploaded twice the width and height are exchanged. Anyone has the same problem? there is another function in PHP more precise?
Thanks