Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

What mechanism does flair use? Today i discovered that this website offers profile badges or flairs to the user to put up on the website. but the url that they provide if ending with .jpg extension. I guess how can a .jpg be always updated with my current profile reputations and how can it accept parameters like ?theme=clean

share|improve this question

migrated from Mar 22 '11 at 6:55

This question came from our site for professional and enthusiast programmers.

Shouldn't this be on meta? – Bryan Ross Mar 22 '11 at 4:24
I guess this one is for – EboMike Mar 22 '11 at 4:24
i am asking about the mechanism or technologies involved in such features of not about the aesthetics of the features. so why should it be on the meta version? – Coding-Freak Mar 22 '11 at 4:26
The wording of the question should be changed. If you're asking how it is done, it should be asked here. If you are saying something is wrong with it (which there isn't) it should be on Meta. – Jacob Mar 22 '11 at 4:27
PLEASE DON"T TOUCH THIS, WHILE I FILE A BUG REPORT. – Robert Harvey Mar 22 '11 at 4:35
what do you mean to say? @robert? – Coding-Freak Mar 22 '11 at 4:38
Look at the close votes. – Robert Harvey Mar 22 '11 at 4:43
Bug report is here:… – Robert Harvey Mar 22 '11 at 4:48
@Coding: You can't see the close votes. For some reason, there are 9 votes to close this question. Normally, 5 will automatically close (or migrate) the question. Something went wrong, hence Bob's authoritative voice. – EboMike Mar 22 '11 at 4:48
Should this question really be on Meta? – alex Apr 11 '11 at 0:15
up vote 8 down vote accepted

Just because it has .jpg doesn't mean it points to a physical file.

Apache example

RewriteEngine on
RewriteRule ^users/flair/image.jpg$ generate-flair.php [PT]

PHP Example

// Generate flair
header('Content-Type: image/jpeg');
// Stream generated JPEG file


your .htaccess example is okay to work with but, how do i put the part ^users/flair/image.jpg to ^users/flair/xxxxxxxxx.jpg, here xxxxxxxxx is the user_id

RewriteRule ^users/flair/(\d+).jpg$ generate-flair.php?id=$1 [PT]
share|improve this answer
your .htaccess example is okay to work with but, how do i put the part ^users/flair/image.jpg to ^users/flair/xxxxxxxxx.jpg, here xxxxxxxxx is the user_id. – Coding-Freak Mar 22 '11 at 4:37
@Coding-Freak See update. – alex Mar 22 '11 at 4:43

An extension in a URL doesn't really mean much.

You can redirect and process requests however you like.

Without knowing exactly how Stack Overflow have implemented it, I'd assume they redirect any requests to[number].png to a script that checks if it needs to recreate the image.

If nothing has changed since the last time it was generated, it would serve a cached image, if things have changed they would regenerate the image and serve it.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .