Dynadot โ€” .com Registration $8.99

Link To Image script

Spacemail by SpaceshipSpacemail by Spaceship
Watch

tandiono

Tandiono.comEstablished Member
Impact
0
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Is this something like what you're looking for?

PHP:
<?php
function link_image($img) {
$link_to_site = "http://www.yoursite.com";
$path_to_images = "http://www.yoursite.com/images/";
echo '<img src="'.$path_to_images.$img.'" /><br />
HTML Code:<br />
<input onclick="this.select();" value=\'<a href="'.$link_to_site.'"><img src="'.$path_to_images.$img.'" /></a>\'><br />
Direct Link:<br />
<input onclick="this.select();" value="'.$path_to_images.$img.'" /><br />
<br />';
}

link_image("test1.gif");
link_image("test2.gif");
link_image("test3.gif");
link_image("test4.gif");
link_image("test1.gif");
?>
 
0
•••
I guess something like this, but im not very familiar with php. can this code be insert into folder and get automatically link the rest of the images? Because i've hundreds of images in each folder. Thanks
 
0
•••
Here. This will automaticly generate code for all images in the /images/ folder.
PHP:
<?php
function link_image($img) {
$link_to_site = "http://www.yoursite.com";
$path_to_images = "http://www.yoursite.com/images/";
echo '<img src="'.$path_to_images.$img.'" /><br />
HTML Code:<br />
<input onclick="this.select();" value=\'<a href="'.$link_to_site.'"><img src="'.$path_to_images.$img.'" /></a>\'><br />
Direct Link:<br />
<input onclick="this.select();" value="'.$path_to_images.$img.'" /><br />
<br />';
}

if ($handle = opendir('./images/')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != "..") {
           link_image($file);
       }
   }
   closedir($handle);
}
?>
 
0
•••
domain

Thanks for the script Jim, can you give me an instruction on how to use this script. As Im not very familiar on how this script works. But more or less I would like the script to be working as something like this :

http://www.myspaceimagecodes.com/glitter_words.php



I'll give away 1 domain for you :


sexirish.com Mon 11/07/2005 Tue 11/07/2006 - namecheap.com - free push


Looking forward to hear from you. Thanks :)
 
0
•••
Just stick the script I provided into a .php file.
Change the http://www.yoursite.com's near the top of the script to your domain.
Create a folder called images and upload your images there.
The script will open up the images folder and generate the code for them.
 
0
•••
I've change the it to this :

<?php
function link_image($img) {
$link_to_site = "http://www.xxx.com";
$path_to_images = "http://pic.xxx.com/pic/1";
echo '<img src="'.$path_to_images.$img.'" /><br />
HTML Code:<br />
<input onclick="this.select();" value=\'<a href="'.$link_to_site.'"><img src="'.$path_to_images.$img.'" /></a>\'><br />
Direct Link:<br />
<input onclick="this.select();" value="'.$path_to_images.$img.'" /><br />
<br />';
}

if ($handle = opendir('./images/')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
link_image($file);
}
}
closedir($handle);
}
?>


I save it to index.php and put it into /1/ folder.. But when i try to open it fail. Is there any thing that I need to do? Thanks
 
0
•••
Try this:
PHP:
<?php

function link_image($img)
{
  $link_to_site = "http://www.xxx.com";
  $path_to_images = "http://pic.xxx.com/1/";
  echo '<img src="'.$path_to_images.$img.'" /><br />
  HTML Code:<br />
  <input onclick="this.select();" value=\'<a href="'.$link_to_site.'"><img src="'.$path_to_images.$img.'" /></a>\'><br />
  Direct Link:<br />
  <input onclick="this.select();" value="'.$path_to_images.$img.'" /><br />
  <br />';
}

if($handle = opendir('.')) 
//I'm assuming that this 1/ folder contains the images, not /images/ folder
{
  while(false !== ($file = readdir($handle)))
  {
    if($file != "." && $file != ".." && $file != "Thumbs.db"/*pesky lil things*/)
    {
      link_image($file);
    }
  }
  closedir($handle);
}
?>
 
0
•••
works like a charm :) One last thing how can I integrate this script into .htm?

Because my main site is .htm and is there anyway to add google adsense on it? Thanks
 
0
•••
Well..to run a php script in .htm you could add this to your .htaccess:
Code:
AddType application/x-httpd-php .htm

Where do you want the adsense to show?
 
0
•••
SecondVersion said:
Well..to run a php script in .htm you could add this to your .htaccess:
Code:
AddType application/x-httpd-php .htm

Where do you want the adsense to show?

How can I call the .php from .htm files?

I've already add the code onto my .htaccess and as for the adsense im able to put it on the top and on the bottom but I can't manage to put it on the middle. Is there anyway? Thx
 
0
•••
tandiono said:
How can I call the .php from .htm files?

I've already add the code onto my .htaccess and as for the adsense im able to put it on the top and on the bottom but I can't manage to put it on the middle. Is there anyway? Thx
You'd do like you regularly would with .php files. .htm is parsed for any php code when that is added to .htaccess.
 
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back