techker Posted April 1, 2018 Share Posted April 1, 2018 (edited) Hey guy's im stock on this issue.. my image up loader works good , it uploads and resizes ok on my PC i select a picture and it uploads correctly, My girlfriends PC uploads the image sideways?? on cell same issue?Sideways? <?php function resizeImage($resourceType,$image_width,$image_height,$resizeWidth,$resizeHeight) { $imageLayer = imagecreatetruecolor($resizeWidth,$resizeHeight); imagecopyresampled($imageLayer,$resourceType,0,0,0,0,$resizeWidth,$resizeHeight, $image_width,$image_height); return $imageLayer; } if(isset($_POST["form_submit"])) { $imageProcess = 0; if(is_array($_FILES)) { $new_width = $_POST['new_width']; $new_height = $_POST['new_height']; $fileName = $_FILES['upload_image']['tmp_name']; $sourceProperties = getimagesize($fileName); $resizeFileName = time(); $uploadPath = "./uploads/"; $fileExt = pathinfo($_FILES['upload_image']['name'], PATHINFO_EXTENSION); $uploadImageType = $sourceProperties[2]; $sourceImageWidth = $sourceProperties[0]; $sourceImageHeight = $sourceProperties[1]; switch ($uploadImageType) { case IMAGETYPE_JPEG: $resourceType = imagecreatefromjpeg($fileName); $imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height); imagejpeg($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt); break; case IMAGETYPE_GIF: $resourceType = imagecreatefromgif($fileName); $imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height); imagegif($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt); break; case IMAGETYPE_PNG: $resourceType = imagecreatefrompng($fileName); $imageLayer = resizeImage($resourceType,$sourceImageWidth,$sourceImageHeight,$new_width,$new_height); imagepng($imageLayer,$uploadPath."thump_".$resizeFileName.'.'. $fileExt); break; default: $imageProcess = 0; break; } move_uploaded_file($fileName, $uploadPath. $resizeFileName. ".". $fileExt); $imageProcess = 1; } if($imageProcess == 1){ ?> Edited April 1, 2018 by techker Quote Link to comment Share on other sites More sharing options...
techker Posted April 1, 2018 Author Share Posted April 1, 2018 Odd if i take a picture with the phone it rotates it side ways.. if i select a picture its ok.. does the phone insert a setting or something in the picture??lol Quote Link to comment Share on other sites More sharing options...
Barand Posted April 1, 2018 Share Posted April 1, 2018 does the phone insert a setting or something in the picture??lol Yes, EXIF data https://readexifdata.com/ Quote Link to comment Share on other sites More sharing options...
techker Posted April 1, 2018 Author Share Posted April 1, 2018 i see....so im guessing i need to manipulate the EXIF on uploading...uhh Quote Link to comment Share on other sites More sharing options...
Barand Posted April 1, 2018 Share Posted April 1, 2018 Or read it and compensate when processing image data Make sure mbstring and exif extensions are enabled then $edata = []; $fname = "myimage.jpg" ; $edata = exif_read_data($fname); Quote Link to comment Share on other sites More sharing options...
techker Posted April 1, 2018 Author Share Posted April 1, 2018 ok cool i will check on my server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.