Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I've recently made a new website and I'm using a template. See this image (link):

enter image description here

The file extention is .php. Can anyone explain this?

NOTE: When an image is posted here, stackexchange creates it's own location to store it. If you're right clicking and saving the pic in the question, you'll get a .jpg. But, right click on the picture here.

Here are screenshots of what happens when I try to save it:

Save as

rotate.php

share|improve this question
    
Were you able to get the .php and display it as an image, even when dowloaded? (the upload is indeed unrelated). –  Vincent Oct 24 '13 at 11:41
    
I don't know what you're asking... Try to save the image in the question now. –  BBking Oct 24 '13 at 11:42

1 Answer 1

up vote 6 down vote accepted

A PHP script on the server (which is what the URL causes to be run) returns a response to the browser which contains the header

Content-Type: image/jpeg

so the browser knows that what is returned is a JPEG image and displays it accordingly.

The browser uses the response headers to determine what to do with content. Client operating systems may behave differently — Windows, for example, has a heavy dependence on the filename extension. But if you attempt to save the image from the browser on a Windows system, you may find it's given a .jpg extension because the browser knows it's a JPEG image.

share|improve this answer
    
Thanks, that's a bit more help. But what would it take to explain why when I go to save the image, it saves it as rotate.php rather than sample-image.jpg ?? Source? –  BBking Oct 24 '13 at 11:45
    
Depends on your browser. When I try and save it in Firefox on Windows, it suggests rotate.php.jpg. Answer updated. –  Andrew Leach Oct 24 '13 at 11:52
    
I'm using Windows 7, Chrome Version 30.0.1599.101 m. –  BBking Oct 24 '13 at 12:02
    
Well there you are. Chrome doesn't add an extension which Windows will understand correctly. –  Andrew Leach Oct 24 '13 at 12:20
    
@bbking: in CMS (content management systems) which support templates, the actual image file names and locations may be stored in a database (sometimes even the data for the image is stored in the database as well). They do this so that the scripts for the site only need reference an abstract concept of "sidebar image." Your example, the abstraction is "rotate.php" which presumably looks up the image content and then passes it through to your browser. –  horatio Oct 24 '13 at 14:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.