Quote:
Originally Posted by arch13
I was under the impression that we were doing /imgs/$base/$base_12345.jpg as our formula.
Also, this is where we are going wrong and the script is dying.
The images are located in /imgs/brewey/brewery_1.jpg. Each building has an image folder in /imgs/ , and a folder for their .php file and other info files in /.
For now, the brewery.php is just in the local root, and that shouldn't be a problem for what we're doing. If that is causing a problem, let me know and I'll get on creating the /brewery folder for the files already.
Brewery images brewery_1.jpg through brewery_12.jpg are all located in /imgs/brewery/.
|
Ok.
So $base is indeed necessary to find the path in /imgs/ we will need to use it twice. Once for the path, once for the filename, as you suggested earlier.
Quote:
Originally Posted by arch13
Thanks for your patience on this Silvy, have I mentioned you kick ass?
(But ohhhh, wait till you see my next silly question  )
|
You're very welcome!
(and don't hesitate to post silly questions, but if there too silly post them in Tilted Nonsense

)
Ok, we have still have the following issues:
- the /imgs/brewery/ lookup
- the fact that brewer_test.php has a different name than what index.php is looking for

- the fact that even though we want to have brewery.php in a seperate dir, it isn't now.
Let's solve the last 2 first:
(I understand you want to keep your current brewery.php as a backup, so we'll work around it)
- make a new dir www/brewery (for all your non-image brewery files)
- copy brewery_test.php to that dir and name it brewery.php
Add 2 lines to index.php:
Code:
$id = $_REQUEST['id'];
if(file_exists($id.".jpg")) {
echo "<img src='$id.jpg'>";
} elseif(file_exists($id.'/'.$id.'.php')){ //add this line
include($id.'/'.$id.'.php'); //add this line too
} elseif(file_exists($id.".php")) {
include($id.".php");
} else {
echo "<img src='Brewerysplash.jpg'>";
}
(I added the first elseif clause)
That should at least allow index.php to find brewery/brewery.php and fall back to /$id.php for all others
Now to look up the correct images:
Change the following line in index.php:
Code:
define ('IMAGE_FS_PATH', '/homepages/6/d93661089/htdocs/img/');
change brewery_test.php: (which is now called brewery/brewery.php!!)
Change some lines here:
Code:
$base = 'brewery'; //CHANGED (removed _ )
$id = $_REQUEST['id2'];
if(file_exists(IMAGE_FS_PATH.$base.'/'.$base.'_'.$id.'jpg')) { //CHANGED added $base.'/'. and .'_'
echo "<img src='".IMAGE_WWW_PATH.$base.'/'.$base.'_'.$id.".jpg'>"; //CHANGED added same as the line above, watch for correct quotes!
} elseif(file_exists($id.".php")) {
include($id.".php");
} else {
echo "<img src='brewerysplash.jpg'>";
}
(I added $base, '/', and '_' to find the images in the correct path.)
Ok, I wonder what the effect of these changes is.