A LIST Apart: For People Who Make Websites

No. 222

Discuss: Sliced and Diced Sandbags

Pages

 <  1 2 3 4 >  Last »

11 server load

Great article, Rob, well done!

In response to Paul’s comment on server load; it’s a fair point. Pixel processing in GD isn’t the fastest. However, it shouldn’t be hard to add some caching to the script. Instead of using printf, sprintf to compile a string and write the final result to a final, say <image name>.cache. Then when you call the alignedImage function, first see if there is a cache file for that image, if so just output the contents of the cache file else process the image. Sure, it might still take time with the initial view of the page, but it’d be a lot faster on subsequent loads.

posted at 01:00 pm on August 22, 2006 by Andrew Collington

12 The Box Office

Crud, there goes my tool The Box Office (since May 2005) totally in the dark :(

It does the same actually ;)

Kindly,
B!

posted at 01:03 pm on August 22, 2006 by Bram Van Damme

13 Hi Rob

Kudos that’s a neat trick and would be dead easy to cache. Anyway I met you at Paolo’s wedding I’ll have to chase you for the photos? ;)

posted at 01:12 pm on August 22, 2006 by Dom Stockdale

14 The Box Office (continued)

Actually, it doesn’t go totally in the dark … The Box Office uses background color approximations, manual adjustment options, etc. Also handy for those who don’t run run PHP on their server or don’t know how to implement it in their current cms/blog.

wbr,
B!

posted at 01:23 pm on August 22, 2006 by Bram Van Damme

15 neat

this is a really neat trick. although, wouldn’t it be better for loading time if you just used the script once to generate the markup, then copy and paste the markup instead of calculating the sandbags dynamically? i also think i agree with the line-height comment. there’s no reason to split a sandbag in the middle of a line or in between lines. nice job on this!

posted at 03:51 pm on August 22, 2006 by jeremy forsythe

16

Jeremy: You do have a good point about reducing the load time, although I think Andy Collington’s comment (see above) about using sprintf to cache the string would probably be better than manually copying and pasting the code (although that very same thought crossed my mind originally!).

Christoph: I concur, working out the ‘correct’ sandbag height based on the line-height would be an excellent way of tackling the issue. Thanks for the comment, I’ll definitely utilise it.

Dom: Small world! Drop me a mail and I can send you a link to the best of the wedding photos if Paolo hasn’t already shown you them.

posted at 04:11 pm on August 22, 2006 by Rob Swan

17 Untitled

Good stuff! I think I’d tweak it, though, to seperate the alt and title parameters – so I can set one without the other. Mind you, I’d probably only use it for eye-candy images where both properties would be null anyway.

posted at 05:10 pm on August 22, 2006 by Chris Hunt

18 Using line-height

How would I be able to use the line-height value in the php script?

The only way I see fit is to manually input the line-height in the function call, but that means I would have to go into the code to change that value every time I decide to change the css. Not something for the believers in separation of code and presentation, eh?

I’m not sure if javascript could pick out the current line height property for an element from the DOM, but even if it’s possible, I still can’t see how to use that value in the (server processed) php code.

Any ideas?

posted at 06:37 pm on August 22, 2006 by Pär Axelsson

19 Reminds me of css/edge

Anyone remember this ?

Well I know it’s not quite the same thing, but it is from 4 and a half years ago.

posted at 07:46 pm on August 22, 2006 by Gabe da Silveira

20 Semantics and IE

You know someone had to say this … while this is a neat concept, how is using a tool such as this semantically correct? Isn’t one of the points of ALA that we promote tools which are standards compliant? Also, I would argue that if your image conveys enough meaning that it requires alternative text, then using CSS to set it as a background image and using the title attribute is not sufficient because it will not be displayed if the image is not there, it will only create a tooltip.

As a reminder, this tool does not take care of IE5-6’s poor handling of transparencies on PNGs. IE5-6 users will still see grayed text like they normally would. Works okay in IE7 (though, I did find that the text gets garbled for text below the medium font setting … and that using the Ctrl+scroolbutton scaled the entire page in the examples).

Would it be too much to have an optional argument for the script that will let one set a default color to look for so that it doesn’t have to look for transparencies? This would make the script a bit more flexible in that it could work on JPGs for example.

posted at 08:36 pm on August 22, 2006 by Brian LePore

Pages

 <  1 2 3 4 >  Last »

Discussion Closed

New comments are not being accepted, but you are welcome to explore what people said before we closed the door.

Got something to say?

Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.

Create a new account or sign in below if you’d like to leave a comment.

Remember me

Forgot your password?

Subscribe to this article's comments: RSS (what’s this?)