automatically generate image linking code php or javascript?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chikooo
Forum Newbie
Posts: 12
Joined: Sun Feb 01, 2009 8:25 pm

automatically generate image linking code php or javascript?

Post by chikooo »

what is the php code or the javascript code that i can put on my site and it will automatically generate a linking code for my site with an image. lets say i have an image on my site and i want the users to be aple to post it anywhere on the internet using html code and that image will linkt o my site. like this one http://www.myhotcomments.com/graphics/53696 how do i make the html code to be genaerated automatically
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Re: automatically generate image linking code php or javascript?

Post by Citizen »

You'll need to be specific about what you want php to actually do.

You can do everything on that page with html. If you want to dynamically create stuff on the page based on stored information, you'll need to start off with the basics of php and mysql.
chikooo
Forum Newbie
Posts: 12
Joined: Sun Feb 01, 2009 8:25 pm

Re: automatically generate image linking code php or javascript?

Post by chikooo »

ok this is the page. espan-glish.com/comments/
i want to display this code <center><a href="http://www.espan-glish.com/comments/index.php"><img src="http://mintywhite.com/images/techtips/0 ... a></center>
below the image that is on that site. but i will have a lot of images on different pages. so i just want a php or java script that will generate the web page url and the image address(url) automatically, so i wont hava to be typing the name of each page for each linking code.

so how do i generate show an image address using php.
i already know how to put a web page self url using php.
i put this code in the head section

<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>


the i add this code whereever i want the url to appear

<?php echo curPageURL(); ?>


but now how do i get an the image url

i would really appreaciate any good help
Citizen
Forum Contributor
Posts: 300
Joined: Wed Jul 20, 2005 10:23 am

Re: automatically generate image linking code php or javascript?

Post by Citizen »

Where are you storing the image locations and names?
chikooo
Forum Newbie
Posts: 12
Joined: Sun Feb 01, 2009 8:25 pm

Re: automatically generate image linking code php or javascript?

Post by chikooo »

on the same folder as the webpage
Post Reply