Jump to content

Recommended Posts

Im wondering if it is possible to have an image tag provide two different urls to a php page

that will check if url to image 1 exists - if it does, display it but if it doesnt go to url 2 and display it.

 

So the html would be something like

<img src="www.alternate_img.php?img1=www.url_to_img_1&img2=www.url_to_img_2">

 

how do you pick up the ?img1=www.url_to_img_1&img2=www.url_to_img_2

in alternate_img.php to check if they exist to display the image in the html img tag?

 

 

Can you do something like that?

This is what I started with but both variables always come back as 0

// Check for a primary Image URL.
if (isset($_GET['img1'])) { // Page is first accessed.
$purl = $_GET['img1'];
} else { // Big problem!
$purl = 0;
}

// Check for a alternate Image URL.
if (isset($_GET['img2'])) { // Page is first accessed.
$aurl = $_GET['img2'];
} else { // Big problem!
$aurl = 0;
}
if (($purl == 0)||($aurl == 0)) { // Do not proceed!
header("content-type: image/jpeg");
$sig_loc = "noimg.jpg";	
$sig = imagecreatefromjpeg($sig_loc);
imagejpeg($sig);	
exit(); // Terminate execution of the script.
}

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.