Dynadot โ€” .com Registration $8.99

Url to the img

Spaceship Spaceship
Watch

jackdomain

Established Member
Impact
34
Hi i have instaled and image hosting script.


What i want and i think that it might be "simple" is when someone use the code to put the img to vb or to the webpage / blog a link to my site.


here is the code

PHP:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);
    if(in_array(strtolower($matches[1]), $accepted)) {
        if($_FILES['file']['size'] <= $maxsize) {
            $newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];
            move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);
            $linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;
            $imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;
            print '<p>Click 2 view in full size:<br /> <a href="'.$imgurl.'" target="_blank"><img src="'.$imgurl.'" border="0" width="50px" height="35px" /></a><br />
			<label for="codebb">Embed on bulletin boards:</label><br />
            <input type="text" class="textfield" id="codebb" value="[IMG]'.$imgurl.'[/IMG]" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
            <label for="codehtml">Embed on webpages or MySpace: </label><br />
            <input type="text" class="textfield" id="codehtml" value=\'<a href="'.$linkurl.'"><img src="'.$imgurl.'" alt="Image hosting by '.$title.'" />&lt/a>\' onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
            <label for="codedirect">Direct link:</label><br />
            <input type="text" class="textfield" id="codedirect" value="'.$imgurl.'" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /></p>';
        } else 
            print '<p>Sorry, that file is too big.</p>';
    } else
        print '<p>Sorry, that file type is not supported.</p>';
}
?>

Thanks alot
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Just change the code generated for people to use to make the image a link, very few people think to remove the link code.
 
0
•••
i asked this ... because i don't know how to do it...
 
0
•••
You can use this :tu:

edit : Myspace code

PHP:
<?php

// Your website here
$my_website = 'http://www.your-website-here.com';

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    preg_match('/\.([a-zA-Z]+?)$/', $_FILES['file']['name'], $matches);
    if(in_array(strtolower($matches[1]), $accepted)) {
        if($_FILES['file']['size'] <= $maxsize) {
            $newname = md5_file($_FILES['file']['tmp_name']).'.'.$matches[1];
            move_uploaded_file($_FILES['file']['tmp_name'], $filedir.'/'.$newname);
            $linkurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).'#'.$newname;
            $imgurl = 'http://'.$_SERVER['HTTP_HOST'].preg_replace('/\/([^\/]+?)$/', '/', $_SERVER['PHP_SELF']).$filedir.'/'.$newname;
            print '<p>Click 2 view in full size:<br /> <a href="'.$imgurl.'" target="_blank"><img src="'.$imgurl.'" border="0" width="50px" height="35px" /></a><br />
			<label for="codebb">Embed on bulletin boards:</label><br />
            <input type="text" class="textfield" id="codebb" value="[URL='.$my_website.'][IMG]'.$imgurl.'[/IMG][/URL]" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
            <label for="codehtml">Embed on webpages or MySpace: </label><br />
            <input type="text" class="textfield" id="codehtml" value=\'<a href="'.$my_website.'"><img src="'.$imgurl.'" alt="Image hosting by '.$title.'" />&lt/a>\' onclick="javascript:this.focus();this.select();" size="70" readonly="true" /><br />
            <label for="codedirect">Direct link:</label><br />
            <input type="text" class="textfield" id="codedirect" value="'.$imgurl.'" onclick="javascript:this.focus();this.select();" size="70" readonly="true" /></p>';
        } else 
            print '<p>Sorry, that file is too big.</p>';
    } else
        print '<p>Sorry, that file type is not supported.</p>';
}
?>
 
Last edited:
1
•••
wow thanks rep added
 
0
•••
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