Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista wifi windows windows vista windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Showing Image URL with PHP


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
beetldude's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2008
11-Jan-2008, 01:41 AM #1
Showing Image URL with PHP
I created a website and I have an index.html; and in there, I have it linking to a rotate.php file which randomly generates a new image from a directory every time you refresh the page. However, if you right click and try to find the image properties, it shows the rotate.php file instead of the image URL. You can see what I am talking about at http://www.boneyourmother.com but be warned, the image it pops out at you may not be work safe!!

What I would really like to do, is make it so that others can send the link of the image to whomever they wish... but I would like each image to have its own page. So if someone sent www.boneyourmother.com/random/free_cat_sign.jpg to a friend, they would see something like the front page instead of just the image itself.

It's kind of hard for me to explain, so if you have any questions that I can answer that may help you understand better, feel free.

Thanks guys.

P.S.. Sorry about the topic, I forgot to change it before posting.

Last edited by beetldude : 11-Jan-2008 01:42 AM. Reason: it's late my brain is slow
Anthony:-P's Avatar
Computer Specs
Senior Member with 449 posts.
 
Join Date: Nov 2006
Location: UK
Experience: Between Intermediate and
11-Jan-2008, 09:55 AM #2
Hi There,

Would love to help, however with your warning up there i don't dare open it in college...don't want to risk my account.

Just a quick question though to use the PHP file are you using include(); require(); or simply using an image tag....?

Regards,
A...
__________________
Currently training at geekstogo!
If your thread is solved, please mark as solved from the 'Thread Tools' menu.
My computer beat me at chess, however it was no match for me at kick boxing!
beetldude's Avatar
Junior Member with 3 posts.
 
Join Date: Jan 2008
11-Jan-2008, 02:39 PM #3
Well, the site was coded a long time ago using an include, but that doesn't seem to work for me anymore (it would print about a page of random letters instead of the image) so I switched to an image tag. I believe we still had that same problem when it was an include anyway. The old rotate.php was coded so that if you click on the image, it will go directly to the image so you could copy the link directly. That rotate.php is lost though.
Anthony:-P's Avatar
Computer Specs
Senior Member with 449 posts.
 
Join Date: Nov 2006
Location: UK
Experience: Between Intermediate and
11-Jan-2008, 02:44 PM #4
Hi there,

Any chance you can post some code at all?

Regards,
A....
Anthony:-P's Avatar
Computer Specs
Senior Member with 449 posts.
 
Join Date: Nov 2006
Location: UK
Experience: Between Intermediate and
11-Jan-2008, 02:55 PM #5
Hello again,

Just had an idea, it's pretty simple.

If you name your images 1.png 2.png and so on

then put this in the include:

PHP Code:
<?php
$i 
rand(MIN,MAX);

echo 
"<img src='/images/$i.png' alt='Some alternate text' />";

?>
NB: You'll need to change MIN to the lowest numbered image and MAX to the highest numbered image.


It's not a masterpiece but it's something simple that you'd be able to use.

If you want them to link to the image then you could use:

PHP Code:
<?php
$i 
rand(0,5);

echo 
"<a href='www.domain.tld/images/$i.png' target='_blank'><img src='/images/$i.png' alt='some alternate text' /></a>";

?>
Hope that helps some,

Regards,
Anthony
__________________
Currently training at geekstogo!
If your thread is solved, please mark as solved from the 'Thread Tools' menu.
My computer beat me at chess, however it was no match for me at kick boxing!
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:49 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.