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. It's always these seemingly simple tasks that become challenges. I got a good handle on how to watermark some photos (thanks to respondents to my previous post) and developed a script that calls a function that uses imagettftext() Essentially, I can upload multiple images and watermark them before they reach their destination folder. Good stuff. Now, I got this crazy idea of watermarking them with a sequence number, so that if I grab 12 images, each will be labeled with it's sequence number (rather than a standard text watermark). I placed $count++ in my script, and then used $count as my $watermark both inside imagettftext and as a variable. It didn't work. The closest I got was after placing $count++ inside a watermark function, but. of course, that merely labeled each photo with a "1" (bc each call of the function was a new iteration. Can someone please offer some direction here. Thanks.
  2. I want to watermark a simple TEXT line on some images (ie: "SAMPLE") I have successfully created a working code and using imagettftext and the PHP manual, I have summized that the coordinates 0,0 will essentially place the beginning of the text at the top left corner of my image. This would remain the same regardless of the image size or shape. Are there coordinates that will consistently designate the lower-right corner? Do the coordinates change for horizontals and verticals; large files and small?
  3. How can I reverse sort from Z to A? Or by last modified?
  4. This has got to be the UGLIEST CODE that you've ever seen, but I'm sure you'll take some conciliatory victory laps in knowing that IT WORKS. I went from the original echo scanDirectoryImages("uploaded"); $directoryList = opendir($directory); while($file = readdir($directoryList)) { if ($file != '.' && $file != '..') { $path = $directory . '/' . $file; to echo scanDirectoryImages("uploads"); // $directoryList = opendir($directory); // no longer necessary to create the handle $directory = "uploads"; //establishes the folder to be located and scanned // while($file = readdir($directoryList)) { // REMOVED as the wrong approach for glob() foreach (glob("$directory/*") as $file) { //OR foreach (glob($directory."/*") as $file) { //BOTH WORK with either QUOTE MARK scheme (is one more correct?) //foreach (glob("$d/*") as $file) { //part of the Learning Process to determine if a variable needed different handling than a hardcoded routing /***** SAMPLE to work with and TEST *****/ //foreach (glob("uploads/*") as $filename) { //echo "$filename size " . filesize($filename) . "<br />"; echo "$file size " . filesize($file) . "<br />"; //PROVED SUCCESS using variable name $file to avoid conflicting names from TESTing to established script if ($file != '.' && $file != '..') { //no longer necessary, but will not interfere. Let's get functional before pretty // $path = $directory . '/' . $file; $path = $file; //the NEW variable $file INCLUDES $directory AND slash; this was easiest solution. //And it worked. //not sure if it better seperated since listing file NAMES would be neater than the ENTIRE PATH //Best way to break it up???? I hope this validates the sincerity that you doubted earlier. Perhaps you can offer a few (or bunches) of tips for better functionality and clean up. PS: I'm still considering a different/more simplistic script and wonder in recursion is beneficial or just stylish. Thanks for the guidance.
  5. 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.
  6. 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"; }
  7. 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.
  8. 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()?
  9. 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*)
  10. 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.
  11. 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.
  12. Code is in this thread above.
  13. 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.
  14. 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?
  15. 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?
  • 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.