Reputation: 2535
I'm making some images with imagejpeg() in PHP and I'm wondering if I have should call my image mysite.com/photos/chicken or mysite.com/photos/chicken.jpg They both seem to work the same. At least for me. Is the .jpg pointless? Unless you want to download the photos and look at them on your computer easily, but I don't.
Upvotes: 2
Views: 110
Reputation: 2170
The extension is an additional hint for client programs and users, so it is useful. Sometimes it even matters technically, so I recommend using an extension.
Also see: http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addtype
"The AddType directive maps the given filename extensions onto the specified content type."
This directive is used in many apache configurations.
Upvotes: 3
Reputation: 13597
Yes. It is just extensions used to determine the software which will run it as well as visual indicator of what type of file it is. You can save your images using imagejpeg() without an extensions and they will work as you've said just fine:)
Upvotes: 1
Reputation: 9671
Yes, you are right. If the image is only displayed via the web browser, the file extension is trivial. It's all about the headers being sent.
Upvotes: 2