Only show EXIF data if it is present

Hi guys, I'm working on a complete revamp of Effervescence and having a lot of fun with the new features.

The way I've got image descriptions and tags implemented is to check via `getImageDesc()!=""` and `getTags()!=""` that these fields are not empty, so as to make the styling cleaner if they are absent.

I would like to do the same with EXIF data. How can I check that the EXIF indeed contains information and not a blank array?

Comments

  • acrylian Administrator, Developer
    You can check the EXIF fields directly (please see the documentation) or you could probably try some PHP array functions like `count`, `in_array` or `sizeof` for example (see http://www.php.net/)

    BTW, nice effervescent mod, but horizontal scrolling is really a little inconvenient...
  • Thanks, I'll try and figure it out with PHP. It's not exactly my strong suit.

    Regarding Effervescence, the horizontal scrolling is just a fun little thing I added for my own gallery. I'm actually starting off from scratch for v2. I might even have to give it a new name, because I have a feeling it will be quite different from my original Effervescence theme.
  • I'm also realizing that `getTags()!=""` is not a good way to check whether the list of tags is empty or not. Do you have tips on how I could do this with PHP?
  • acrylian Administrator, Developer
    Alright, I somehow actually didn't realize that you are the original author, sorry...:-) Needless to say that any new theme is welcome.
  • acrylian Administrator, Developer
    Since these are all arrays, I would think that the php array functions `count` might be suited for that:
    http://www.php.net/manual/en/function.count.php
  • Got it to work with both tags and EXIF, cheers!

    Just for reference I'm using `count(getTags())!=0` and `count(getImageEXIFData())!=0` to check whether the tags or EXIF contain any data.
  • This is what i'm looking for i believe. Where did you implemented the `count` in the image.php or somewhere else and how?
Sign In or Register to comment.