Install a php script in PHP-FPM & Caddy via Docker

Install docker Either regular docker install or rootless. Create a new directory Create a new directory where you will store your Docker Compose file and PHP/html etc files. For example, you can create a directory called “phpapp” in your home directory: write a docker compose file paste the below code in a new file called… Continue reading Install a php script in PHP-FPM & Caddy via Docker

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 );… Continue reading PHP Image Magick Drop Shadow

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… Continue reading php Filter var & common regex patterns

Published
Categorized as PHP, regex
Exit mobile version