Jump to content
xisto Community
Sign in to follow this  
caronthegerman

Bennet's Multifolder Random Image Problems with Bennets Random Image Selector

Recommended Posts

Thanks for pointing that out.I made the change and when I view the source code, it displays it as /useruploads/random***.jpg but the picture still fails to come up. I've also noticed that if I leave out the / at the end, a ? appears after the randomizer.php. This doesn't appear if I put / at the end.What does the question mark mean/do?

Share this post


Link to post
Share on other sites

Thanks for pointing that out.
I made the change and when I view the source code, it displays it as /useruploads/random***.jpg but the picture still fails to come up. I've also noticed that if I leave out the / at the end, a ? appears after the randomizer.php. This doesn't appear if I put / at the end.

What does the question mark mean/do?


can you attach as a forum reply your existing randomizer.php so i can check it out? there are still a few bugs with it.
about the question mark "?"

on your html source code i saw this lines..

<FORM METHOD="LINK" ACTION=""> <INPUT TYPE="submit" VALUE="New Picture"> </FORM>

the empty action part causes the extra '?' to be padded. there should be something between 'ACTION=""' in your case you can just put randomizer.php on that part. an <a href='randomizer.php'> will also work as replacement for the FORM tags.
Edited by vhortex (see edit history)

Share this post


Link to post
Share on other sites

can you attach as a forum reply your existing randomizer.php so i can check it out? there are still a few bugs with it.about the question mark "?"

on your html source code i saw this lines..

<FORM METHOD="LINK" ACTION="">  <INPUT TYPE="submit" VALUE="New Picture">  </FORM>

the empty action part causes the extra '?' to be padded. there should be something between 'ACTION=""' in your case you can just put randomizer.php on that part. an <a href='randomizer.php'> will also work as replacement for the FORM tags.

Agreed, change the action to randomizer.php.

Also the reason why the image isn't showing up is because of that extra slash at the beginning. If you change the slash to ./ then it should work fine (globally understood by all browsers).

For example <img src="./'.$randir[$getrandir].''.$imgarray[$rand].'"

Also, just a bit of useful advice. Remember that when running your server on a linux machine then it is essential to have all file names and extensions name with proper casing. When I was building a site, in the php file i referred to an image called "image1.png" however the real name of the file was "image1.PNG" but because I didn't write the extension in uppercase then linux couldn't find the file.

So basically what was once <img src="image1.png" /> wouldn't work but <img src="image1.PNG" /> would work because the real image was named like that.

Not really relevant to this topic but something your MUST remember.
Edited by 8ennett (see edit history)

Share this post


Link to post
Share on other sites

For example <img src="./'.$randir[$getrandir].''.$imgarray[$rand].'"

that's the fix you are looking for. i was wrong to assume that the script returns the full folder information from the main folder or 'www'/'public_html'

Share this post


Link to post
Share on other sites

Also the reason why the image isn't showing up is because of that extra slash at the beginning. If you change the slash to ./ then it should work fine (globally understood by all browsers).
For example <img src="./'.$randir[$getrandir].''.$imgarray[$rand].'"


Yea that worked. Thanks.
I also changed the form action. However, the url is still http://forums.xisto.com/no_longer_exists/
The question mark after randomizer.php is still showing up. Although it doesn't bother me, I don't get why it does.

Also, could I change the line:
return '<img src="./'.$randir[$getrandir].''.$imgarray[$rand].'" width="600" align="top">';
so that if I click it, it also opens randomizer.php?

For example, could I <a href a php returned image as well?

I attached the randomizer.php file to this post.


Oh and 8ennet, I started the php tutorial and am reading it daily.

Share this post


Link to post
Share on other sites

Also, could I change the line: return '<img src="./'.$randir[$getrandir].''.$imgarray[$rand].'" width="600" align="top">';
so that if I click it, it also opens randomizer.php?

For example, could I <a href a php returned image as well?

I attached the randomizer.php file to this post.


Oh and 8ennet, I started the php tutorial and am reading it daily.


Yes you can change the line:

return '<img src="./'.$randir[$getrandir].''.$imgarray[$rand].'" width="600" align="top">';

to:

return '<a href="http://forums.xisto.com/no_longer_exists/; target="_blank" border="0"><img src="./'.$randir[$getrandir].''.$imgarray[$rand].'" width="600" align="top"></a>';

This will open randomizer in a new tab (or window) however if you want it to load on the current page remove target="_blank". Also we set the border to 0 so that default blue square isn't around the edge of your image (the kind that turns purple once you have visited that link).

Also great to hear you are reading that tutorial, how's it going?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.