Random Image issue with path to images

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
WebPhenom
Posts: 9
Joined: Wed Apr 07, 2010 7:04 pm

Post by WebPhenom »

Right - was just demonstrating what the Server Document Root did to the GET Folder. The absolute path that you showed does not work in the GET Folder and the end result is that it cant find anything and shows the No Image icon.
WebPhenom
Posts: 9
Joined: Wed Apr 07, 2010 7:04 pm

Post by WebPhenom »

Also - i even tried it without trying to overwrite the defaults.


These settings do not work either and this is directly in the radim php code:

Code: Select all

*  See readme.htm file for further instructions!
*******************************************************************************/

/* The default folder with images */
$settings['img_folder'] = 'http://www.mysite.com/images/subpages/landscape/';

/* File types (extensions) to display */
$settings['img_ext'] = array('.jpg','.gif','.png');

This script seems to only work with relative links to the images folder, at least I could not find a way to make it work with absolute or root/site paths.

Seems like such a basic thing to have, surely there is a way.?

ALso if I just place an image tag with a root path it works, like this:

Code: Select all

<img src="/images/subpages/landscape/image011.jpg" alt="" width="350" height="150" border="0">
This works.

But this does not.

Code: Select all

<img src="<?php $_GET['folder']= 'images/subpages/landscape/'; include ($_SERVER['DOCUMENT_ROOT'] . "/includesPHP/randomimage.php"); ?>" width="350" height="150" alt="Random Image" />
So it must be in how PHP or the script is grabbing the location of the files on the windows server .
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

The "img_folder" variable (or $_GET folder one) mustn't be an URL because if it's an URL then PHP can't read the folder for all image files inside.

Since the folder path is RELATIVE to the randim.php file with the setting you posted the randim.php will try to display images from this folder:
/includesPHP/images/subpages/landscape/

From what I understand your easiest solution might be simply to move the randim.php file to the "images" folder and then pass in the GET variables like
subpages/landscape/
subpages/landscape2/
subpages/someotherfolder/

If not, to be able to give a solution please post the exact URL where:

1. your randim.php file is
2. your images folder is
3. URL of the phpinfo.php file on your server:
http://www.phpjunkyard.com/extras/phpinfo.zip
4. two sample pages where you are using randim.php and the respective image sub-folders you are trying to include
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply