PHP PDO Mysql 101
| | |

PHP PDO Mysql 101

PHP PDO MySQL Needed to make a simple php script with mysql in it, so I decided to use PDO because… well peer pressure 😐 so heres a basic PHP PDO MYsql script. The idea is I have a table called table with a field called field in a database called somedatabase. We have 1000…

PHP Image Magick Drop Shadow

PHP Image Magick Drop Shadow

Want to add a simple drop shadow on any image? well here’s how to do it on the fly via PHP and Image Magick. < ?php $img = new Imagick(‘images/image.jpg’); $img->setImageFormat(‘png’); $shadowed = $img->clone(); $drop_shadow = $img->clone(); $drop_shadow->setImageBackgroundColor( new ImagickPixel( ‘black’ ) ); $drop_shadow->shadowImage( 80, 3, 5, 5 ); $drop_shadow->compositeImage( $img, Imagick::COMPOSITE_OVER, 0, 0 );…

php Filter var & common regex patterns
|

php Filter var & common regex patterns

People … quit messing about with ereg_replace / preg_replace / eregi or other things you know nothing of… use the php filter_var. DO IT. Commonly found bullshit on the interwebs : function isValidEmail($email){ return eregi(“^[_a-z0-9-]+(\.[_a-z0-9-]+)@[a-z0-9-]+(\.[a-z0-9-]+)(\.[a-z]{2,3})$”,$email); } eregi is deprecated and silly, the above WILL miss some of the weirder or longer email addresses like school/company…