Jump to content

phppup

Members
  • Posts

    683
  • Joined

  • Last visited

Everything posted by phppup

  1. I was thrilled to have gotten a recognizable result after tinkering with the script form the manual and using foreach (glob("upload/*.jpg") as $filename) { echo "$filename size " . filesize($filename) . "<br />"; } I have now run both your scripts and gotten the same output which was an array designated listing of the files in the root directory (including the script itself). Now I am still wrestling with replacing the WHILE with a FOREACH. I have found alternate scripts that seem more simplified than this one. Maybe the recursive style is causing me trouble [not even sure if the approach is really favorable] but I would like to meet this challenge successfully.
  2. I've been at it all day, but half (ok, maybe just a third) of what I'm reading may as well be in Chinese. And another third is incorrect samples and misinformation that doesn't even work. That leaves my own ingenuity, and help form you. I tried using the example you provided, as well as visiting the PHP.net page, and was not able to get results. Doesn't the glob() need a reference directory? It's not simply going to automatically search the entire server, is it? At least now I understand why slapping a glob into glace in conjunction with a WHILE seems to blow-up the script and scramble the results to something that destroys the gallery display (most of the time). I understand a good portion of what you told me, but do appreciate the greater enlightenment. At this point I don't even want the answer given to me, but I'm still having trouble with getting a simple result from $globFiles = glob('*'); echo "<pre>" . print_r($globFiles, 1) . "</pre>"; //OR the PHP.net sample foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; }
  3. I am trying to get THIS code to SORT so I can use it this weekend. I do not have the time now to re-write it or play with testing (for learning purposes). Seeing the actual answer and how it works will likely be very helpful. I can then review the manual and these posts and fine tune and re-write with a more educated approach, but for now, finding a working solution is the priority.
  4. I think the essentials of my code are echo scanDirectoryImages("uploaded"); $directoryList = opendir($directory); while($file = readdir($directoryList)) { if ($file != '.' && $file != '..') { $path = $directory . '/' . $file; Does glob() need to go directly with the "uploaded/*.*" in the first line ECHO? It fails there. Since the $directoryList comes from $directory does it needed to be effective there? on which? On either? The $path contains data from $directory AND $file, but isn't this too far down in the process to intiate glob()?
  5. Yup, I admit it (as if you needed my guilty plea), I never read up on readdir(). It worked in a tutorial and it just kept on working. I will try to get this problem SORTED out (see what I did there? LOL), but please keep in mind that I chose my username intentionally (as I do not work with coffee as readily as you and many others here). You may have chosen your username with equal intent (not entirely sure yet. *wink*)
  6. echo scanDirectoryImages("uploaded"); is ahead of the function that I provided above. It is a recursive function, so it gets called repeatedly inside the script. I have tried echo scanDirectoryImages(glob("uploaded/*.*")); and completely lost the gallery. I understand that nobody wants to write my script for me, and I am trying NOT to and therefore I am making efforts that seem logical to me. I appreciate that, but honestly, I have checked every link provided and many more on my own. I have tried renaming the $path, and nesting the glob() in every area of my script. Ultimately, as previously mentioned, I either get no affect or I lose the gallery entirely. It's not for lack of trying, but we all know that a misplaced slash, comma, or quote will prevent me from obtaining success. Evidently there is something that I am not seeing. Or something i expect to work that isn't. Perhaps the other pertinent question should be, why would the display (that tested well with three images) suddenly sort randomly? I just want these photos to run or order. Or maybe reverse order. But I suppose I should resolve one problem before moving to the next. PS: sometimes seeing the answer creates a cascade that eliminates the need for postings on similar issues because the learning process takes root.
  7. There is no updated code. All my efforts failed by either causing the gallery to display in its arbitrary order. Otherwise, it eliminated the display entirely because the code was faulty. I thought that glob($directory); was the correct utilization of the command either in conjunction with or before assembling the $directoryList. Again, my efforts seem to be missing the mark, so if you have a viable answer, please let me know.
  8. I thought so but I got the same result. I guess I missed re-running the script. Thanks PS: Like i said, CLEARLY one of those weeks.
  9. Do I need to run the function (or a derivative of it) again? Is there a way to clear the exif_read_data($filesname) do that it grabs in fresh?
  10. It's been one of those weeks, yes. I've tried placing global just about everywhere possible. How about a clue, if not the answer?
  11. I don't know. I must be missing something. Even tried W3 and other sample scripts.
  12. I've been plugging glob() EVERYWHERE, but do not seem to be getting a satisfactory result of sorting my images. Am I doing something wrong? Or is a recursive script incapable of sorting? A solution would be wonderful. Thanks
  13. Tried this $filename2 = $imagePath; $exif2 = exif_read_data($filename2); echo "<pre>"; print_r($exif2); echo "</pre>"; but NO RESULT.
  14. 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?
  15. 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?
  16. 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.
  17. 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?
  18. 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?
  19. 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?
  20. 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)?
  21. 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.
  22. 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.
  23. 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)?
×
×
  • 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.