We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24449
    • 81 Posts
    Hi Philbert,

    I’ve just updated Autogallery.inc.php on our server to include a [+name+] placeholder that should be the filename without extension. It works by finding the last dot in the full name, so it won’t help with double extensions etc.

    To prevent the double extension business you can replace line 169, which looks like this:
        $params['tnpath'] = $gallerypath . '/tn_' . $file;
    


    with this:

     $params['tnpath'] = $gallerypath . '/tn_' . $params['name'];


    I’m still avoiding doing it by default since I think many people won’t look at the backend and would rather not have to try to work out why one of their mp3s has the same thumbnail as one of their flvs. Although I respect that this is probably quite a rare case, I find working out whats gone wrong in cases like that harder than in cases where the problem is obviously the filename having two extensions (and there now being a published fix).



    Ramsay
      • 24449
      • 81 Posts
      Sorry, I didn’t address the capitalisation question. The way to do that is to paste the following immediately after line 165 (so make it the new line 166):
      $params['name'] = strtoupper(substring($params['name'], 0, 1)) . substring($params['name'], 1)


      Its not exactly elegant code - before any PHP gurus comment!- and I haven’t tested it, but its Saturday night and I have had several glasses of wine...


      Ramsay
        • 24449
        • 81 Posts
        ooops: you need a semicolon on the end of that!...

          • 23235
          • 40 Posts
          Okay I updated to the new version and made the changes to the inc.php file you suggested, but now my page comes up blank. sad
            • 23235
            • 40 Posts
            I went back and took out the code to make the names uppercase and it works again. So the problem is with the uppercasing code. Thanks for the double extension fix. That part works great now.
              • 24449
              • 81 Posts
              Hi philbert,

              The correct code is:

                $params['name'] = strtoupper(substr($params['name'], 0, 1)) . substr($params['name'], 1);


              ("substr" vs "substring"). Sorry; the dangers of coding on a Saturday night!


              Ramsay
                • 19383
                • 10 Posts
                Hi,

                can somebody integrate a IPTC-reader to import the image-descriptions rolleyes ?
                That would be very useful cool

                Like this: http://www.meshed.de/2008/iptc-daten-mit-php/
                  ---------------------------------------------------
                  (PS: sorry for my "GoogleTranslator" english laugh )
                  • 23235
                  • 40 Posts
                  Hmm. This time it didn’t break my page, it just didn’t uppercase the first letter in the file names.
                  http://www.yoursivet.com/pet-pics.php
                    • 24449
                    • 81 Posts
                    Hi,

                    Philbert: can you PM me your email address and I’ll send you the inc.php file I have. It works on my test site so we can see if its the modification or something else thats not working for you.

                    Modix: That looks fairly easy to add to autogallery - assuming it is built in to the standard install of PHP. If not it would still be easy to do as an add-on. Do you have any test images with the data headers in them?


                    Ramsay
                      • 24449
                      • 81 Posts
                      As a follow-up: it looks like the IPTC parser IS in default PHP. I’ll have a look in to it.

                      I still need a test image or two though...


                      Ramsay