Welcome to weblogs.com.pk Sign in | Join | Help

Adnan Siddiqi

Lets get technical


  • View Adnan Siddiqi's profile on LinkedIn
Optimize OpenX Banner delivery by using Data URIs

OpenX is an open source Ad Management System which was written in php. Like Adsense OpenX also provide Javascript code to display banner on any site. Usually when you place multiple ads on a page, it could slow down your page performance due to script block appear on page. Though OpenX has tried its best to optimize it by introducing Sing Page Call but still it loads up JS for different zones. Most of the banner Ads we see today are image based ads. If you have 3 Ads placed on page then you should expect 3 x 2 calls on Ad Server where 2 requests are for php files to display Ads.

 Recently I tried to further optimize it by displaying base64 encoded banners by using Data URI schemes. Data URI schemes gives you option to embed objects like images in your HTML thus it helps to save requests you need make to fetch image. Though it increase the size by 33% but it gets reduced if your apache server is mod gzip/deflate enabled. Base64 encoded URIs are supported in modern browsers like FireFox v 3.x,Safari > 9 ,Chrome,Internet Explorer > 7.

First of all I modified the code in admin area. What all I did that i read the file after it gets uploaded, converted into base64 and saved it in db. After successful operation I removed physical image from db thus it was quite useless now. Later I modified query to fetch Banners and changed image URL in delivery/spc.php so that it delivers base64 encoded image. That's it! With this change you can save your precious bandwidth and request and can serve images faster. If you are a developer and concerned about performance then you should sure give it a try.


P.S: I myself provided consultancy for OpenX. In minimal charges I can help you to speed up your banner delivery on your site. For contact just drop your mail at kadnan(AT)gmail(dot)com

Posted: Wednesday, November 3, 2010 11:28 PM by kadnan
Filed under: ,


No Comments

Anonymous comments are disabled