calrockx Posted September 29, 2008 Share Posted September 29, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/126289-using-php-to-display-an-image/ Share on other sites More sharing options...
CroNiX Posted September 29, 2008 Share Posted September 29, 2008 Best to post the code you have. Quote Link to comment https://forums.phpfreaks.com/topic/126289-using-php-to-display-an-image/#findComment-652996 Share on other sites More sharing options...
The Little Guy Posted September 29, 2008 Share Posted September 29, 2008 how are you typing the URL into the address bar? Quote Link to comment https://forums.phpfreaks.com/topic/126289-using-php-to-display-an-image/#findComment-653013 Share on other sites More sharing options...
calrockx Posted September 29, 2008 Author Share Posted September 29, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/126289-using-php-to-display-an-image/#findComment-653075 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.