February 20th, 2009
A cool jQuery plugin : PHP / jQuery Image Replacement
How many times have you wanted to use a very cool looking font for your website, but have withdrawn the idea because you thought that font won`t display properly in everyones’s system.
Well fear not, I had previously posted a tutorial on how you can use PHP to display those lines of texts which use some odd font, by automatically converting it to an image (Tutorial : Convert Text into transparent PNG Image using PHP), this way, you can easily display text with odd fonts.
Recently I found a very neat plugin which automatically converts any text (with font of your choice) into an image i.e from now on you don`t have to worry about text with different or odd fonts. They`ll be automatically converted into a compatible image via this plugin, And don`t worry about the image tag and all, this plugin manages everything
Plugin name : PHP / jQuery Image Replacement
Plugin Home Page/Demo : http://www.xanthir.com/pir/
Usage
The usage was pretty simple.
- After unzipping the archive, Open
pir.php and First set the fonts folder in the php page. - In your website, include jQuery and then include the
jquery.pir.min.js (for production). -
$(function() { $.pir.options.php="pir.php"; //compulsary to include the php which converts text to image. $("h1").pir({font: "yourfont.ttf", wrap: true}); //will enable automatic text warping.});
Pretty Simple huh ! Enjoy
