Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by phppup

  1. Tried this $filename2 = $imagePath; $exif2 = exif_read_data($filename2); echo "<pre>"; print_r($exif2); echo "</pre>"; but NO RESULT.
  2. I know there won't be much there, but seeing the change will confirm effectiveness. I am starting with File A and altering it and overwriting it as File A again. What do I need to do to capture the EXIF from the edited version? How do I get it to grab the data aknew?
  3. Would you like to fill in the blanks and help me to understand this, since my re-reading has not enabled me to pick it up from the documentation, even after many minutes?
  4. Yes, I understand that. But shouldn't calling the EXIF again after the script is ended bring up the new information? I even tried to re-run the function as function newInfo, but it pulled the same data.
  5. Tried it on the first line $directoryList = opendir($directory); and made it $directoryList = glob($directory); and lost the entire gallery. What am I missing, please?
  6. I used print_r($exif, 1) - - not sure of the differention of print_r($exif) - - to get a handle on things. Now, for confirmation, I want to print EXIF data at the end of the script to verify that the function was successful and that the EXIF data was changed. However, even though I have confirmed that the actual image was altered, the EXIF that is printed afterward remains identical to the original. I have tried to rename it and change the location but the results are the same. What do I need to do in order to get the revised EXIF data for the same file?
  7. The heart of the script is here $directoryList = opendir($directory); while($file = readdir($directoryList)) { if ($file != '.' && $file != '..') { $path = $directory . '/' . $file; if (is_readable($path)) { if (is_dir($path)) { return scanDirectoryImages($path, $exts); Yet none of my SORT commands have altered the (seemingly) random selection of images. What sort command and placement would be recommended?
  8. 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)?
  9. 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.
  10. 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.
  11. 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)?
  12. 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?
  13. What is the difference in result between echo '<pre>', print_r($exif, 1), '</pre>'; and echo '<pre>', print_r($exif), '</pre>';
  14. 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 ) )
  15. 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?
  16. I'm going to have to double check it. My image was not being rotated and overwritten. Nor was a new file being created.
  17. 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.
  18. 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?
  19. 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.
  20. Is there a benefit to keeping my form and the PHP that processes it within a single file?
  21. 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?
  22. I don't have access to my computer at the moment, but... The first script is a basic HTML form (with some JS and CSS links) that is saved as a PHP file. To combine them, I have simply cut and pasted the form code (in its entirety) below the PHP code (displayed previously). I have not changed any file names or paths. Also, after deeper investigation, I saw a line in a jQuery file (not my forte) that was written as "data.html" . Is it possible that it is falling to find "data" because AFTER my modification there is no longer an HTML file? If this is true, can I redirect it to the PHP file? Perhaps a better question would be "What is the benefit to keeping my form and the PHP that process it within a single file? Thanks for the help and HAPPY THANKSGIVING.
  23. I already have a working PHP/HTML uploading form that I've been working on and tweaking as a single PHP file. Now, I am attempting to integrate a progress bar. It seems almost impossible to find a working script to show the progress of multiple files as they upload. However, I have one that is "good enough" and have broken it down thusfar so that I can effectively integrate it into my working script. At this point, (aide from the JQuery, CSS, etc.) it consists primarily of two files: The first is a PHP file containing the form and basic links for function and style. The second is a PHP upload file that is handling the "heavy lifting." I have broken it down to this: $dir = 'uploads/'; $count = 0; if ($_SERVER['REQUEST_METHOD'] == 'POST' and isset($_FILES['files'])) { // loop all files foreach ( $_FILES['files']['name'] as $i => $name ) { // now we can move uploaded files if( move_uploaded_file($_FILES["files"]["tmp_name"][$i], $dir . $name) ) $count++; } echo json_encode(array('count' => $count)); } No names or file locations have been changed and it functions as originally designed in this condition. However, if I combine the first file with this file, I loose the echo json_encode(array('count' => $count)); result, which is expanded in another file to be a final message of "You have uploaded $count files successfully." What am I doing wrong or missing? Is there an easier way to do this? A link to a fancy progress bar for multiple file upload would be wonderful, as most that I've found actually do not work.
  • 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.