The best way to store and serve up user profile images
<p>My website has public-facing profiles. Users may have 145x145 profile images that are displayed to people. At the moment, I store profile images under a directory on my server: <code>/images/users/</code> I then use a .ashx file to serve the right image up for each page:</p>

<pre><code>&lt;!-- from the html --&gt;
&lt;img id="imgLogo" runat="server" alt="Company Logo" src="" /&gt;

// from the page code behind Page_Load event
imgLogo.Src = "userImage.ashx?id=" + UserId;

// from the .ashx file
String imagePath = context.Server.MapPath("~/images/users/")+context.Request.QueryString["id"]+".jpg"; 
</code></pre>

<p>This code was in place when I joined the project (the guy who wrote it has since left.) It seems to work nicely enough, but I'm new to web development, and unfamiliar with other ways of implementing systems like this.</p>

<p>I now need to add a different kind of image to the site - something like a tall banner ad for a user's profile. As such, these images will be much larger than the 145x145 profile avatars.</p>

<p>How should I implement these for my site? Should I use a similar system to the one currently in place, with images stored in <code>/images/users/largeImage</code> and the src being set to a <code>largeUserImage.ashx</code> file? Or should I store the images in my sql database?</p>

<p>It's likely that I'll want to add more user-defined images in the future - maybe stuff like user photo collections and similar. Is there anything I should consider to make a system that is easily scaleable?</p>
