Display/format exif data

software development

#1

So I’d like to get exif data displaying for my images on my photoblog. I’m happy using the built in php exif_read_data function. What I don’t know how to do is to only take the parts of all the info it outputs that I want and make it looks nice.

You can see what the php outputs at here. here’s the code I’m using:

What I would like the end result to be is that using a simple table for layout, I have the thumbnail displayed and below that is printed:
Taken with a Canon PowerShot SD400, on 2006:04:11. Exposure 1/100 at f/3.5

I’d apprechate sigguestions on how best to accomplish this. Thanks!

P.S. my server seems to be out of action at the moment, so my example page may not load up.

–Matttail
art.googlies.net - personal website


#2

How about this, with some adjustments.


#3

That is awesome! That’s exactly the kind of example I was looking for. Much apprechated.

–Matttail
art.googlies.net - personal website


#4

Did you get it to work?
I tried the scripts and although I can display the exif data I cannot display images or the thumbnail images. I am sure it is something simple.
I have tried it on my own lax PHP on this PC and also via PHP4 and PHP5 at DH.

Later.
I fiddled about and got it working to show the Thumbnails okay. Clicking on the thumbnail produces the thumbnail rather than the full picture so I still have a bit to do. But I must go and play with the dog else she will get fat!


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#5

I didn’t actauly try to get it’s thumbnail generation working. All I wanted was just grabing the relevant exif data and displaying that, not the entire output. So I just grabed that part of the ‘gallery’ file and put it into my own system.

It is a nice little gallery idea, isn’t it?

–Matttail
art.googlies.net - personal website


#6

Yes it is a useful program. I never even knew there was a thumbnail in each camera image. Saves having to create one with image software.
Must save on server resources as well compared to the likes of Gallery2.

Later.
Oh I fixed the remaining problem I had, so it will display the full size image now.


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#7

Could you post your “final” source here and/or in the wiki?


#8

The two files are here:-

gallery.php
showthumb.php

They are a bit raw since I just wanted to get them working.
They are both placed in one folder together with the images. The images should be lowercase .jpg not .JPG and no spaces in the filenames. These settings including the location of the images folder can be changed of course but the PHP will need adjustments.


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#9

It’s not that there’s a tumbnail already stored in the image, but rahter that the server is generating it. The script references a ‘php function’ or script that loads up the image and resizes down, making it fast to load. The only draww back to this, and is the same with the exif data, is that this script consumes CPU resources for each and every page load. Every time you or someone else wants to see thoes images, the server must look at all the files in the directory, grab the jpgs, read the exif data, produce thumbnails, and compile the page for the browser.

That’s all fine and good for most low traffic sites, but it’s possible you may start running into problems if you get more traffic or some fark type links.

–Matttail
art.googlies.net - personal website


#10

It’s not that there’s a tumbnail already stored in the image, but rahter that the server is generating it.

Seems to me it is really referring to a thumbnail actually imbedded in the jpeg from some cameras. Not in all jpeg’s.

[quote]THUMBNAIL A file is supposed to contain a thumbnail if it has a second IFD. All tagged information about the embedded thumbnail is stored in this section.

http://us3.php.net/manual/en/function.exif-read-data.php

exif_thumbnail() reads the embedded thumbnail of a TIFF or JPEG image.

http://us3.php.net/manual/en/function.exif-thumbnail.php[/quote]
Probably won’t copy correctly, but here is a piece with error handling:

Example 1. exif_thumbnail() example

} else {
// no thumbnail available, handle the error here
echo ‘No thumbnail available’;
}
?>

Never understood the sense in creating thumbnails on the fly, since they are usually only a fraction of the size of the original large image anyway, and don’t take much disk space or time to create one in advance. A bunch of custome intermediate sizes might make sense to create on the fly.


#11

You could have let me down gently :slight_smile: I rather like the idea of another picture lurking in my images. You will be saying next there is no Santa Claus or a reindeer called Rudolph with a big red nose …ahhh soon be Christmas now!


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#12

I suppose the thumbnail idea is a throwback to pre high-speed connections when we all tottered about with dial-up modems speeds of 300 baud. I must admit that the webcam images I upload I just resize with HTML to get 20 ‘thumbnails’ showing on the screen per page. It does not matter now that they are still image files of 40 -50 k rather than 4 or 5 k for thumbnails with the high speed connection.


Norm

Opinions are my own views and are not the views of DreamHost.
Any advice offered by me should be acted upon only at your own risk.


#13
  1. There are still a lot of dial up users out there.
  2. The faster you can display the web page the happier the viewer is.

These facts are brought to you by: madeupbyme, inc :slight_smile:

lol,
Silk


#14

1) There are still a lot of dial up users out there.

Yes.

“While the percentage of Americans who say they use the internet has continued to fluctuate slightly, our latest survey, fielded February 15 – April 6, 2006 shows that fully 73% of respondents (about 147 million adults) are internet users, up from 66% (about 133 million adults) in our January 2005 survey. And the share of Americans who have broadband connections at home has now reached 42% (about 84 million), up from 29% (about 59 million) in January 2005.”

http://www.pewinternet.org/PPF/r/182/report_display.asp

The percentages are not consistent with the numbers, but if somewhere around half the internet users are still using dial-up, that’s a bunch of people.

It does not matter now that they are still image files of 40 -50 k rather than 4 or 5 k for thumbnails with the high speed connection.

I was not questioning using thumbnails. I question creating thumbnails “on the fly” or at the time of viewing. It makes more sense to create and save them in advance, because they only add a small percentage more disk space compared with the larger versions. Creating them on the fly can slow down everyone, broadband or dial-up, while the cpu cranks, every time the page is viewed.

I “hate” html resizing, and my nose flute shrieks when I notice it. :slight_smile:


#15

My post wasn’t really meant for debating, but generating thumbnails “on the fly” would make perfect sense if the gallery allowed uploading from the viewers. I personally do not know how much cpu usage this would incur. But I do wonder what would happen to the server if a small program kept accessing a gallery that read the directory and then generated thumbnails on the fly. I would think this would create a DOS, or am I wrong? (BTW if I am wrong I do not want to know how to)
Silk