Running Image Service from PHP

Scenario : Imagine that you want to run an image service and your clients will use these images in their static site developments. The moment you change these in the server it automatically reflect in the client designs. This is a POC design and can be used in KIOSKS, Web designs etc. Basically wherever you need the dynamic image you will use image src as a php destination. <img src=”” /> Whenever the server receives the request it will serves the image whichever is assigned to that. Concept: <?php header(“Content-type: text/xml”); $txt=”http://www.haneefputtur/xyx/138778535913.jpg”; $image=imagecreatefromjpeg($txt); imagejpeg($image); imagedestroy($image); ?> If you wish to make it dynamic then store the image data in a mysql database. Then select the image randomly or by sending query parameter so that you will get dynamic images.   Hereis the sample codes to get and display data from mysql database   <?php $servername = “localhost”; $username = “xxxxxxx”; $password = “xxxx”; $dbname = “haneee_2015”;   // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die(“Connection failed: ” . $conn->connect_error); }   $sql = “SELECT img_name FROM hanee_2015.tbl_banners WHERE active=1 AND img_name LIKE ‘%.jpg%’ LIMIT “.$_GET[“img”].”, 1;”; $result = $conn->query($sql);     […]

» Read more