• (nodebb)

    position:relative in CSS was probably added because it fixed a heap of old (v<=6) Internet Explorer rendering bugs.

  • Japes (unregistered) in reply to Zemm

    But we don't fix rendering bugs in old versions of IE, it only encourages them. Let them update or suffer with their incorrect life choices.

  • Bill (unregistered)

    A lot of companies held on to IE6 way too long because of in house web apps that depended on its quirks.

  • LH (unregistered)

    Key words here: "mid-2000s."

    The real WTF here is PHP ducks

  • LH (unregistered)

    Also, the explanation for the WTF is wrong.

    For each row, it would read the image ID from the database. Then it would read it in memory to get height and width, and with that information it would create its attributes. Without knowing the rest of the configuration, we don't really know if this is even a real WTF. With some aggressive caching this may hit the database only once per client.

  • Webskale (unregistered)

    At least they didn't use ImageMagick...

  • JohnnySlick (unregistered)

    But if you don't do it this guy's way, it's too easy for people to steal your CSS code!!!

  • DigitalDan (unregistered)

    So what was the performance improvement, if any? Inquiring minds want to know.

  • (nodebb) in reply to DigitalDan

    To query the database or not query the database (for supposedly static data)... That is just not a question!

  • Ashley Sheridan (google) in reply to Webskale

    ImageMagick might well have been faster, although the memory usage probably would have been a big higher...

  • foxyshadis (unregistered)

    That's got to be a pretty huge css file once it's all done. I bet just loading it drags up pageload time significantly.

    (PS, there should be a <?php just before the query($sql);.)

  • Chris (unregistered)

    The <?php is there, at least in the page source. But the "<" isn't escaped, so the browser thinks it's a tag.

  • (nodebb) in reply to LH

    @LH:

    Sorry, I'm struggling to see how your explanation differs from the one in the article. You both agree that it's reading the image ID (and filename) from the database, then loading the image into memory and creating the attributes and the rest of the CSS style.

    Perhaps you read the article as implying that the image data itself is being read from the database? To me the article text is ambiguous on this point but I can see how you might have interpreted it that way.

    I do have to take issue with one sentence in your comment though: "Without knowing the rest of the configuration, we don't really know if this is even a real WTF." Yes, yes we do.

  • (nodebb) in reply to LH

    Huh. 24 hours later and I just figured out what PHP ducks were.

  • dufel (unregistered)

    There's actually something to be said for explicitly setting the dimensions of your images in the stylesheet - without that, you get some funky layout jumping as the images are loaded, and if one is missing your layout can get really off.

    However, it really should be done during a build step, not on the page load.

  • Worf (unregistered) in reply to jkshapiro

    Please explain. "duck" is a common auto-replace for a certain swear word, but that doesn't make sense. "sucks" works, but...

  • (nodebb) in reply to jkshapiro

    PHP ducks

    Little Donald Tables…

  • devjoe (unregistered) in reply to dufel

    img[width=800][height=600]

    Html only, no Css required

  • Matthijs (unregistered) in reply to LH
    For each row, it would read the image ID from the database. Then it would read it in memory to get height and width [....] we don't really know if this is even a real WTF
    Since it is loading image meta-information from the database, it makes no sense to me to still load the entire image in memory just to get its meta-data.

    There is something to be said to read out all image meta-information from a database. You could probably even make a case for creating unique CSS classes for them. Presumably there are use cases where a dynamically generated CSS file makes sense, so that whole "The CSS linked to a PHP file" is not TRWTF either in my opinion. But needlessly doubling your static file-reads? Well, that's got to be at least a bit of a WTF.

  • (nodebb) in reply to Worf

    @Worf: @LH is ducking, to avoid being punched for saying that PHP is TRWTF.

  • eh (unregistered) in reply to foxyshadis

    I've a 400+ KB CSS file, part of an extension though. Slows down rendering in Thunderbird, Firefox is fine with it.

  • v (unregistered)

    WTF TDWTF... Auto dimensions help for matching the size of a css background image how exactly? Relative position was probably needed for some case too. And the code sample is missing the opening php tag.

    This site is failing worse and worse every day...

  • Mathijs (unregistered) in reply to Matthijs

    You know, even with languages like PHP, you can just read a file's metadata without loading it fully into memory. On Linux systems this can be faster than reading mysql.

    Both neglectable though, proper solution (if the elements styled are also dynamic), to cache the css or define it in the same logic which generates the blocks.

  • Anonymous (unregistered)

    As long as we're on the subject of bizarre CSS, why the fuck do those #RGB codes have 15px top and bottom padding AND a 1px gray border, outside the padding?

    http://i.imgur.com/q0n0mgP.png

    See the 1px bgcolor line through the "poin" in pointer? That's the border.

Leave a comment on “What A Load”

Log In or post as a guest

Replying to comment #:

« Return to Article