Page 1 of 1

automatically generate image linking code php or javascript?

Posted: Mon Feb 02, 2009 5:12 pm
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

Re: automatically generate image linking code php or javascript?

Posted: Mon Feb 02, 2009 5:46 pm
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.

Re: automatically generate image linking code php or javascript?

Posted: Mon Feb 02, 2009 6:14 pm
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

Re: automatically generate image linking code php or javascript?

Posted: Mon Feb 02, 2009 6:18 pm
by Citizen
Where are you storing the image locations and names?

Re: automatically generate image linking code php or javascript?

Posted: Mon Feb 02, 2009 8:09 pm
by chikooo
on the same folder as the webpage