By epb on October 13, 2011
I needed a small php function that could take an address (which lacked a zip code) and fetch a best guess postal code for it. I had a database full of addresses with city and state, but no zip code. Thankfully, if you have enough information in your address to locate it with the Google [...]
Posted in php |
By epb on April 17, 2011
Looking for a quick and easy to use encryption class for PHP? I stumbled upon Cryptastic in my searches for example code to use with mcrypt for a personal project. I must say it’s quite handy. It implements a message integrity check and handles the initialization vector stuff for you making encrypting data as easy [...]
Posted in php | Tagged encryption, mcrypt |
By epb on February 6, 2011
There may be times you need to find the bounding box of an SVG path. One way to find it would be to parse the path and then apply any group transformation on it to find the range of X and Y coordinates the object occupies. However that’s a bit of code, and I’m quite [...]
Posted in php | Tagged hopefully_that_made_sense, ImageMagick, php, problem, svg |
By epb on July 18, 2010
I really don’t have a shorter description for this. I was working on a personal project the other day and realized that this might be a nifty function. Basically, you know all those snippets to make cropped thumbnails (squares and the like), and how most of them either center or crop to the top of [...]
Posted in php | Tagged gd, images, php
By epb on May 31, 2010
An odd quest perhaps: but adding album art to an MP3 (in ID3 tags) is readily doable with the KTaglib extension for PHP. Once you have it, you can use a script like this to add artwork to an MP3: $mp3 = new KTaglib_MPEG_File(’2.mp3′); $idv2 = $mp3->getID3v2Tag(true); $album = new KTaglib_ID3v2_AttachedPictureFrame(); $album->setType(KTaglib_ID3v2_AttachedPictureFrame::FrontCover); $album->setPicture(‘testalbum.jpg’); $album->setMimeType(‘image/jpeg’); $idv2->addFrame($album); [...]
Posted in php | Tagged metadata, mp3, php
By epb on March 12, 2010
You can do quite a bit of unorthodox stuff with PHP. If you head over to epbsoft.com, you’ll find several flash coloring sheets I made with PHP, not Flash. (Sort of anyway.) I make them by first creating specially formatted SVG (Scalable Vector Graphics) files and feeding them to a PHP script that writes ActionScript [...]
Posted in linux, php | Tagged actionscript, flash, php
By epb on March 3, 2010
I might take a look at installing MongoDB on my server. I like the idea of a document-driven, NoSQL database, especially after working with relational SQL databases for years, and MongoDB looks interesting. You can read more about it in Developing scalable PHP Applications using Mongo DB. What caught my interest is how flexible using [...]
Posted in linux, php | Tagged php, rambling