Jump to content

Using PHP to display an image


calrockx

Recommended Posts

I set a DIV class's background property to use a php file as the background image.

 

The problem is, I can't get that php file to display an image.  Enter that php file name directly to the browser and it should simply show an image, not any code.

 

My question is, how do I do that? How do I make a php page render to show an image?

I know the header is involved, but some attemps to make that happen didn't work out so well.  What I want to do is put an if...else statement in there so that depending on the $_GET value, that php file will display one of a number of images.

 

Can anyone spell out in a quick few lines of code just the format to get an image showing and then I can try to work it from there?

Link to comment
Share on other sites

Oh I don't have much going right now.  I guess I can post the if-else statement I have going..

 

if(!$_GET[image]) {
		echo '/sections/_other/image.php/?width=600&height=450&&image=/sections/residential/_cover/cover.jpg'; } 
	else {
		echo '/sections/_other/image.php/?width=600&height=450&&image=/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].''; } 

    }

 

Those GET varaibles are based on what the user clicks on the website.

I just need to know how to get it to output an image.  For example, I use this rotator script on another site, and when you go to it in the browser, it just shows you an image - http://cultural-distiller.com/_images/global/backgrounds/main/rotator.php

 

 

I tried looking at that code for some clues, but it's beyond me. 

Link to comment
Share on other sites

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.