Jump to content

Recommended Posts

I'm a little stumped here.

 

I have a DIV background set to this:

 

background: url('http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php') center center;}

 

And the code in that big_pic_image.php reads:

<?php

if (!$_GET[image]) {
	$image = "http://vitanova.charlesrubinoff.com/sections/_other/image.php/?width=600&height=450&image=/sections/$_GET[section]/_cover/cover.jpg"; }
else {
	$image = "http://vitanova.charlesrubinoff.com/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].'"; }

header("Content-type:image/jpeg");
readfile("$image");

?>

 

 

That php file uses some variables to know which image to display.  So, for example, if I go to http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php?section=residential in a browers, an image shows up.  If I leave off that query at the end, nothing.

 

The problem is...if I set that php file along as the DIV background, it doesn't have any queries attached to it, so no image comes up.  Is there a way I can set it as the background, and then the big_pic_image.php looks at the browser url to know which values to give the variables?

 

How can I have this script "know" what the user clicked so it will show the appropriate image?

 

Link to comment
https://forums.phpfreaks.com/topic/126396-passing-along-php-variables/
Share on other sites

okay, how do I implement that?

 

I tried this, but that didn't do it...

 

<?php

basename($_SERVER['PHP_SELF']);

if (!$_GET[image]) {
	$image = "http://vitanova.charlesrubinoff.com/sections/_other/image.php/?width=600&height=450&image=/sections/$_GET[section]/_cover/cover.jpg"; }
else {
	$image = "http://vitanova.charlesrubinoff.com/sections/'.$_GET[section].'/'.$_GET[category].'/'.$_GET[image].'"; }

header("Content-type:image/jpeg");
readfile("$image");

?>

 

just not sure how/where to put that

 

skunkbad,

 

that echo output the file name, big_pic_image.php

 

and I found that if I add this

$query = $_SERVER[QUERY_STRING];

 

it will return the query string.  but that's if i type it in right there, it'll output that particular query. 

 

what i need is to have the div background set to http://vitanova.charlesrubinoff.com/_other/includes/big_pic_image.php  and then have that php page "see" whatever page the user is on in order to pick up the query from the url and display the correct image accordingly

 

 

oops, i should have said that.

 

it's an external css file.  i know this can be done inline, and external complicates it, but i know there's gotta be a way.

 

that big_pic_image.php, when referenced by the external css, just needs to talk to the browser and see what link the user clicked i guess, so the if-else statement will know what the query string is

And you're not going to be able to see what page a user is on (easily and consistently, at least).

 

$_SERVER['PHP_SELF']

$_SERVER['REQUEST_URI']

$_SERVER['SCRIPT_NAME']

 

$_SERVER['SCRIPT_FILENAME']

 

Yeah, that's great, now figure out what page they're on from an external PHP file that the browser fetches for CSS. -_-

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.