Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About phppup

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I have a PHP script that reads the image files in a folder and displays them for viewing. When originally tested with three images, it seemed to be displaying them in alphabetical order by name (as desired). Now, with more image files added, it is displaying the pictures in a seemingly random order. Can I use a SORT command similar to the method for organizing data from a database in my script (to organize the files by name)?
  2. Thanks for the lesson. And it seems that even altering rotation in Photo Viewer (and I'm assuming most 'common' tools) changes the rotation that the user sees, but either erases it or leaves it at 1 (behind the scenes). Perhaps professional software like Photoshop offers more options. It is rather interesting that the info is erased, but I digress. Thanks again for the help.
  3. So during the upload process, rotation needs to be handled before resizing? Or will the resizing be adversely effected then? No way to retain the EXIF data? Thanks for the help.
  4. Does resizing eradicate other data (by default). Is there a way to retain this data? Is the solution to simply ROTATE before resizing (during the upload process)?
  5. I suppose it is VERY DIFFICULT to alter the orientation if none is detected. Do smartphones use a different method of orientation? Could uploading an image remove the data?
  6. What is the difference in result between echo '<pre>', print_r($exif, 1), '</pre>'; and echo '<pre>', print_r($exif), '</pre>';
  7. BEFORE Array ( [FileName] => myTest.jpg [FileDateTime] => 1574967654 [FileSize] => 12566 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => COMMENT [COMPUTED] => Array ( [html] => width="500" height="244" [Height] => 244 [Width] => 500 [IsColor] => 1 ) [COMMENT] => Array ( [0] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 80 ) ) AFTER Array ( [FileName] => myTest.jpg [FileDateTime] => 1574967654 [FileSize] => 12566 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => COMMENT [COMPUTED] => Array ( [html] => width="500" height="244" [Height] => 244 [Width] => 500 [IsColor] => 1 ) [COMMENT] => Array ( [0] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 80 ) )
  8. The test image is on the server in an upload folder which is in the same folder as this script (above). I confirmed connectivity to the image by printing EXIF data, but the image did not change. If it were overwritten, then the image file's 'last modified' info would change. For some reason, nothing is being altered or created from the original file. Do I need to move or create a line in the script?
  9. I'm going to have to double check it. My image was not being rotated and overwritten. Nor was a new file being created.
  10. So how come I am getting no result and you have success? What an I missing? How do I transfer the unaltered pieces of EXIF data? I've read multiple webpages. Most accept that it's lost in the rotation process, but that seems somewhat of a lazy inevitability.
  11. Yes, I am going to try that. If I'm understanding correctly, the script checks the orientation inside the EXIF and then changes the degrees of rotation accordingly. Does the new image then contain EXIF info that head been adjusted to reflect the new orientation?
  12. I'm not sure what you mean. I think I need to compare the code with the test image's EXIF info, but not sure how to get that either.
  13. Is there a benefit to keeping my form and the PHP that processes it within a single file?
  14. I have some photos that were taken using a cellphone in an upright/vertical position. They were downloaded and placed in a folder to be viewed on a webpage but they displayed horizontally/sideways (with the persons head on the left). I am assuming that the EXIF information in the image tells it which side is up and what the intended 'top' of the picture should be.. I want to have a PHP function that will rotate the image to its intended display position so that photos of mountain ranges [intentionally holding the smartphone sideways] are horizontal and portraits [where the smartphone in upright] are vertical. I placed this code in a PHP file but got no change in the image: function correctImageOrientation($filename) { if (function_exists('exif_read_data')) { $exif = exif_read_data($filename); if($exif && isset($exif['Orientation'])) { $orientation = $exif['Orientation']; if($orientation != 1){ $img = imagecreatefromjpeg($filename); $deg = 0; switch ($orientation) { case 3: $deg = 180; break; case 6: $deg = 270; break; case 8: $deg = 90; break; } if ($deg) { $img = imagerotate($img, $deg, 0); } // then rewrite the rotated image back to the disk as $filename imagejpeg($img, $filename, 95); } } } } $filename = 'upload/myTest.jpg'; correctImageOrientation($filename); Am I using the correct approach to get the desired result? Is the code correct?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.