Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?
@  agyat : (18 April 2013 - 11:10 AM) false feelings.

Replying to Bennet's Multifolder Random Image


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

8ennett

Posted 19 August 2010 - 11:58 PM

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://www.loldmypan...zer.php#bottom" 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?

caronthegerman

Posted 19 August 2010 - 10:34 PM

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://loldmypants.c...zer.php?#bottom
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.

vhortex

Posted 19 August 2010 - 07:34 PM

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'

8ennett

Posted 19 August 2010 - 06:28 PM

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.

vhortex

Posted 19 August 2010 - 05:36 PM

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.

caronthegerman

Posted 19 August 2010 - 03:16 PM

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?

vhortex

Posted 19 August 2010 - 06:48 AM

i checked your site and there was a problem..
if you added an extra '/' on the end of the URL.. the picture fails to load. you can fix this by rewriting this part of your code

<img src="useruploads/random139.jpg" width="600" align="top">

into

<img src="/useruploads/random139.jpg" width="600" align="top">


to do that change on your generating script, just locate this line of code

return '<img src="'.$randir[$getrandir].''.$imgarray[$rand].'" width="'

and change it to

return '<img src="/'.$randir[$getrandir].''.$imgarray[$rand].'" width="'


see the red item..

i discovered the problem when i click your hotlink.. normally this wont cause problems but you must also note that some links are being padded with an extra / on some browsers.

8ennett

Posted 18 August 2010 - 02:45 PM

Yeah i think I know what you mean, add this to the end of the <img> tag in randomizer.php

align="top"

or failing that try

align="texttop"

It's because of the adverts either side of the image, just change the image alignment and it should work fine. eg.

<img src="blah.jpg" align="texttop" />

caronthegerman

Posted 18 August 2010 - 01:48 PM

Hey it's me again. For some reason the pictures that come up on my randomizer.php are sometimes forced under where the picture is supposed to be. For example, if it is supposed to be in the middle of the screen, the top of the picture will be right where the bottom of the picture is supposed to be. When this happens the picture is under the "New Picture" button and you can only see a tiny bit of the top.


Do you know what the problem is?

It happens very randomly, but, because the images are random too, it might be because of the picture.

caronthegerman

Posted 16 August 2010 - 11:29 PM

Thank you both. It works perfectly :)

Review the complete topic (launches new window)