User Graphic Suggestions
am 08.01.2008 02:44:45 von Jonathan Wood
The Website I'm developing allows some users to upload a custom header
image, which is seen by that user and all users signed up by that user.
I'm trying to decide the most efficient way to handle this. I don't want to
hit the database to get the image every time I render a page, and I don't
think I want an image stored in memory for every user online. Caching just
doesn't seem useful here as each user online could potentially be seeing a
different image.
One thought I'm having is to actually store the image in a file folder with
a name that matches the user's ID, and then I could just reference that
image from my HTML.
I'd be curious to see if anyone else had some ideas on this.
Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
Re: User Graphic Suggestions
am 08.01.2008 03:12:19 von mark
"Jonathan Wood" wrote in message
news:uPAyOgZUIHA.5816@TK2MSFTNGP06.phx.gbl...
> The Website I'm developing allows some users to upload a custom header
> image, which is seen by that user and all users signed up by that user.
>
> I'm trying to decide the most efficient way to handle this. I don't want
> to hit the database to get the image every time I render a page, and I
> don't think I want an image stored in memory for every user online.
> Caching just doesn't seem useful here as each user online could
> potentially be seeing a different image.
>
> One thought I'm having is to actually store the image in a file folder
> with a name that matches the user's ID, and then I could just reference
> that image from my HTML.
>
> I'd be curious to see if anyone else had some ideas on this.
Assuming that the individual images are going to be the same size or very
nearly, I'd probably do the following:
1) Store the various images in a subfolder
2) At Session_Start, work out which image is to be used and store its name
as a session variable
3) Use a MasterPage with an image control which is populated from the
session variable
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
Re: User Graphic Suggestions
am 08.01.2008 04:42:30 von Jonathan Wood
Mark,
> Assuming that the individual images are going to be the same size or very
> nearly, I'd probably do the following:
>
> 1) Store the various images in a subfolder
>
> 2) At Session_Start, work out which image is to be used and store its name
> as a session variable
>
> 3) Use a MasterPage with an image control which is populated from the
> session variable
Yep, I had figured on all those. (Although for #2, I may just have a static
method the gets the image filename and have that method check if it's
already stored in a Session variable.)
I just barely came up with the idea of storing the image on disk instead of
in the database and was just trying to think it through. One concern is that
image files could get orphaned from deleted users but I could take steps to
check that.
Thanks.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com