PDA

View Full Version : I got bored



beer
18-02-2007, 03:50 PM
So i thought id put an image hosting script up. http://imagehosting.rarehabbo.co.uk its a freely downloadable script that i edited a bit. Enjoy!

F32
18-02-2007, 03:59 PM
Adding a banner and bg doesn't count as editing it lol :P

beer
18-02-2007, 04:06 PM
lol i edited basic.php cos when u copied the img tag, it would return the thumbnail and not the proper image so i edited it so its the proper image. I also removed the url tag bit. i also changed the title :P

Isolde
18-02-2007, 04:20 PM
I like script +rep

beer
18-02-2007, 04:23 PM
www.imagehoster.6x.to click download :]. If u want the edited basic.php file here it is:

<?
// --------------------- (C) 2006 by TPAX --------------------- //
// ------- PLEASE DO NOT REMOVE MY (C) FROM THE SCRIPT -------- //
// ------------------------- THANX :) ------------------------- //

include "config.php";

if (!isset($_FILES['userfile'])) exit;
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
if ($_FILES['userfile']['size']>$max_size)
{
echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">File is too big !</font><br>\n"; exit;
}

if (($_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg") || ($_FILES['userfile']['type']=="image/png"))
{

// generate random signs
$zufall = rand(1,9);
$zufall2 = rand(1,26);
$buchstaben = array( "1" => "arx",
"2" => "opt",
"3" => "bwy",
"4" => "cqs",
"5" => "viu",
"6" => "rgh",
"7" => "jdv",
"8" => "klz",
"9" => "bfi", );

$buchstaben2 = array( "1" => "a",
"2" => "b",
"3" => "c",
"4" => "d",
"5" => "e",
"6" => "f",
"7" => "g",
"8" => "h",
"9" => "i",
"10" => "j",
"11" => "k",
"12" => "l",
"13" => "m",
"14" => "n",
"15" => "o",
"16" => "p",
"17" => "q",
"18" => "r",
"19" => "s",
"20" => "t",
"21" => "u",
"22" => "v",
"23" => "w",
"24" => "x",
"25" => "y",
"26" => "z", );

$unikat = $buchstaben[$zufall] . time() . $buchstaben2[$zufall2];

// upload progress
$file = $_FILES['userfile']['name'];
$new_bild = $unikat.substr($file, strrpos($file, "."));
$res = move_uploaded_file($_FILES['userfile']['tmp_name'], "./" . $path . $new_bild);

if (!$res)
{
echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">Didn't work, please try again</font><br>\n"; exit;
}

else
{
?>
<br>
<?

//set url variables
$imgf = $new_bild;
$thbf = $tpath.$imgf;
$urlf = 'http://' .$domain .'/' .$path .$imgf;

//create thumbnails
function createthumb($name,$filename,$new_w,$new_h)
{
$system=explode('.',$name);

if (preg_match('/jpg|jpeg|JPG/',$system[1]))
{
$src_img=imagecreatefromjpeg($name);
}

if (preg_match('/png|PNG/',$system[1]))
{
$src_img=imagecreatefrompng($name);
}

if (preg_match('/gif|GIF/',$system[1]))
{
$src_img=imagecreatefromgif($name);
}

$old_x=imageSX($src_img);
$old_y=imageSY($src_img);

if ($old_x > $old_y)
{
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}

if ($old_x < $old_y)
{
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}

if ($old_x == $old_y)
{
$thumb_w=$new_w;
$thumb_h=$new_h;
}

$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thum b_w,$thumb_h,$old_x,$old_y);

if (preg_match("/png/",$system[1]))
{
imagepng($dst_img,$filename);
}
if (preg_match("/gif/",$system[1]))
{
imagegif($dst_img,$filename);
}

else
{
imagejpeg($dst_img,$filename);
}

imagedestroy($dst_img);
imagedestroy($src_img);

}

createthumb($path.$imgf,$tpath.$imgf,$tsize,$tsize );
?>
<head>
<script type="text/javascript">
<!--
function highlight(field)
{
field.focus();
field.select();
}
//-->
</script>
<title>Rare Habbo Image hosting</title>
</head>
<body bgcolor="#272f80" background='background.gif'>
<center>
<table border='0' bgcolor='white'>
<link rel="STYLESHEET" type="text/css" href="style.css">
<FORM action="nowhere" method="post">
<center>
<tr><td>URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo 'http://' .$domain .'/' ?>viewer.php?id=<? echo $imgf; ?>"></td></tr>
<tr><td>DIRECT URL:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo $urlf; ?>"></td></tr>
<tr><td>HTML:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value='<a href="<? echo 'http://' .$domain .'/'; ?>viewer.php?id=<? echo $imgf; ?>"><img src="<? echo 'http://' .$domain.'/'.$tpath.$imgf; ?>" border="0"></a>'></td></tr>
<tr><td>BBCode:</td><td><input type="text" name="thetext" onClick='highlight(this);' size="60" value="<? echo $urlf; ?>"></td></tr>
<tr><td>IMAGE:</td><td><a href='viewer.php?id=<? echo $imgf; ?>'><img src='<? echo $thbf ?>'></a></td></tr>

<?
}
}

else
{
echo "<font color=\"#333333\" face=\"Geneva, Arial, Helvetica, sans-serif\">You selected a wrong filetype!</font><br>\n"; exit;
}

}

if ($tsize <= 380)
{
echo "</table>";
echo "<table border='0' bgcolor='white' width='457'>";
echo "<tr><td><center><a href='./index.php'>back</a></td></tr>";
echo "</table>";
echo "<br><br>";
echo "</body>";
}
?>

Isolde
18-02-2007, 04:25 PM
Thanks. =] Whats the difference then the current basic anmd this one?

beer
18-02-2007, 04:39 PM
the current basic in the bbcode box returns the url tag and the img tag returns thumbnail I edited it so it returns the proper image in just the [img] tag

Isolde
18-02-2007, 04:43 PM
okay. i see. thanks =]

i'll recommend your site for the helpful soruce.

Unpredictible.
18-02-2007, 04:50 PM
downloaded that ages ago, forgot about it though

Isolde
18-02-2007, 04:56 PM
I got a problem.

When i upload i get a message.
http://www.host.direct-hosts.net/upload/index.php

Any ideas?

beer
19-02-2007, 12:32 PM
lol i think u fixed it didnt u? :rolleyes:

Isolde
19-02-2007, 04:39 PM
Yeah thanks. That was before.

Want to hide these adverts? Register an account for free!