include '../../snippets/connect.php'; 

$orgid = $_GET['orgid'];

if(!isset($orgid) || empty($orgid)){

     die("Please select your image!");


$query = mysql_query("SELECT orghomepic FROM org_home_pic WHERE orgid='".$orgid."'");
$row = mysql_fetch_array($query);
$content = $row['orghomepic'];

   if (empty($content)) {
        **$image  = imagecreatefromjpeg('http://www.ineed.org.uk/dev/media/images/nohomepic.jpg');  

      header('Content-type: image/jpg');

       } else {

       header('Content-type: image/jpg');
       echo $content;


So this was working previously and upto maybe 1 week ago it was not working, was wondering if anyone had any suggestions at all as to why it isn't/stopped working... or what i could fundamentally change to get the required result...

Which is if the image in teh database exists use it(this bit works fine)... if it doesnt exist display default (the bold bit - Doesnt Work)

4 Years
Discussion Span
Last Post by tom.vardy.12

The url is requesting for user and password, if this is not your domain maybe it's a counter measure for hotlinking issues. If it's yours domain then just use server path, for example:

$image  = imagecreatefromjpeg('/var/www/dev/media/images/nohomepic.jpg'); 

Edited by cereal


And now it is obvious that this stopped working when i added authentications to my site for the development stage, thank you cereal thread solved.. 1 shot!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.