Category: Development
I recently was doing some css development, and ran into a right little head scratcher
I was having some positioning issues with a background image, and so i wanted to specify that in Internet Explorer, you use one image, in any other browser you use another
In my Css i had seperated it out into using a header element and a header_ie element
My first port of call was http://www.conditional-css.com/usage
Getting the [if IE] working was perfect, however getting the counter of it was more difficult
The suggested method is below
[if ! Opera] - Used if the browser is not Opera (for example)
However this did not work for me at all. After some poking around i found the answer, but for the life of me i cannot find the site again.
The below code works fine, note the additional exclamation marks
<!--[if !IE]><!--><div id="header"><!--<![endif]-->
<!--[if IE]><div id="header_ie"><![endif]-->
Came across this today messing around with WAMP server. The index page it has has some images. I was looking to replace them as i was feeling lazy about creating an Index page
I couldnt find the images it was using, so had a look in the code. What they had done was encode the image straight into base65 encoding.
I like the idea, basically all you need is your PHP script, and no images, you dont have to worry about the permissions or directory structure or anything. Kind of nifty. Were you no further encode your scripts say with ioncube or the like, you could be fairly sure that your images in your script couldnt be replaced
Here is how it works:
1. Encode the image: http://www.motobit.com/util/base64-decoder-encoder.asp
2. use the result as a string in php, with <<< EOFILE and a carriage return preceeding it, and a carriage return and EOFILE; at the end of it.
3. Using the base64_decode() method, you can produce your image from the encoded string
WAMP use this in conjunction with a switch statement and GET variables to produce their images. Install WAMP and examine the index.php page it produces for a full working example.
I really like this. I know it beefs up your code size, making pages longer to load, but for something small, like a newsletter, it would save on calls to a central server.

