views:

1038

answers:

6

A couple of years ago, we had a graphic designer revamp our website. His results looked great, but he unfortunately introduced a new unsupported font by the web browser.

At first I was like, "What!?!"... since most of our content is dynamic and there was no real way to pre-make all of the images. There was also the issue of multiple languages (since we knew Spanish was on the horizon).

Anyway, I decided to create some classes to auto-generate images via GDI+ and programatically cache them as needed. This solved most of our initial problems. However, now that our load has increased dramatically, there has been a drain on our UI server.

Now to the question... I am looking to replace most of the dynamic GDI+ images with a standard web browser font. I am thinking of keeping some of the rendered GDI+ images and putting them in a resx file, but plan to replace most of them with Tahoma or Arial fonts via asp:Labels.

Which have you found to be a better localized image solution?

  • Embedding images into the resx
  • Only adding the image url into the resx
  • Some other solution

My main concern is to limit the processing on the UI server. If that is the case, would adding the image url to the resx be a better solution compared to actually embedding the image into the resx?

A: 

Because of caching, I'd rather add only the image url into the resx. Caching is much better for static content (i-e plain files ) than for generated content.

Johan Buret
+3  A: 

see my response here

This can be done manually or using some sort of automated (CMS) system.

The basic method is to cache your images in a language specific directory structure and then write an HTTP handler that effectively removes the additional directory layer. eg:

/images/
    /en/
     header1.gif
    /es/
     header1.gif

In your markup or CSS you would just reference /images/header1.gif. The http hander then uses session (if language is user specific), or config (if site specific) to choose which directory to serve the image from.

This provides a clean line bewteen code and content, and allows for client side caching. Resx is great for small strings but I much prefer a system like this for images and larger content. especially on the web where it is typically easy to switch images around.

Jack Ryan
The only thing I can think of here though is that if the user changes languages, they would have to clear their cache to view the different content. Not necessarily a big deal, but something to be aware of.
Mitchel Sellers
+1  A: 

I had the same problem a few years back and our interface team pointed us to SIFr. http://wiki.novemberborn.net/sifr/

You embed your font into a Flash movie and then use the SIFr JavaScript to dynamically convert your text into your font. Because it's client-side, there is no server-side impact.

If the user doesn't have Flash or JavaScript installed, they get the closest web-friendly font.

As an added bonus: because your content is still Text -- Google can search and index the content -- a huge SEO optimization.

bryanbcook
I have to say I've had *very* mixed results with SIFR in terms of quality and performance. Caveat emptor.
annakata
+3  A: 

You should only need to generate each image once, and then save it on the hard disk. The load on your site shouldn't increase the amount of processing you have to do. That being said, it almost sounds like you are using images for things you shouldn't be. If there are so many different images that you can't keep up with generating them, it's time to abandon your fancy images for things that shouldn't be images, and go back to straight text. If the user doesn't have the specified font installed, it should just fall back to a similar looking font. CSS has good support for this.

Kibbee
A: 

I'd be very cautious about putting text in images at all, CSS with appropriate font-family fallback is probably the correct response on accessibility and good MVC grounds.

Where generation really is required I think Kiblee and JayArr outline good solutions

annakata
A: 

this is an excellent one

vasista