ExTrEmEDwarf Posted June 15, 2011 Posted June 15, 2011 Alright, i was using an image host script but i found a better one which is more reliable and faster, also doesnt have a ton of shit code which slows down all the images and the site streaming. The cons of the new script is that it doesnt have a function from the old one; it had an image shortener link since you upload the image. For example when you were uploading a new image you get this link even when the images were uploaded in a folder(PS: Even without the .png/jpg or whatever format it could still be shown in html and bbcode tags) : http://yoursite.com/?di=1013081552314 and the new one is: http://yoursite.com/image/imagename.png I want someone to adapt the code from the old to the new, or to create a new one for me. And because coders doesn't discriminate, i've added a small price as gift to the coder, its 5 minutes job for a good coder so its 1$ free :3 Else, if you dont want the 1$ i can give ya +1 karma. Simple and plain. The money will be paid in paypal only. Regards.
fdLP. Posted June 15, 2011 Posted June 15, 2011 so you want to change http://yoursite.com/?di=1013081552314 to http://yoursite.com/image/imagename.png if so, i dont think its a good practise because others can upload an image with the same name so which one you will be serving to each one? i would go with http://domain.com/images/image_id/image_name if you wanna do it as this, reply and ill code it as soon as possible.
ExTrEmEDwarf Posted June 16, 2011 Author Posted June 16, 2011 so you want to change http://yoursite.com/?di=1013081552314 to http://yoursite.com/image/imagename.png if so, i dont think its a good practise because others can upload an image with the same name so which one you will be serving to each one? i would go with http://domain.com/images/image_id/image_name if you wanna do it as this, reply and ill code it as soon as possible. no, i want the opposite. My image host is supposed to have small links, the first one was calculated with MD5 hash, i really wanted a smaller link :)
fdLP. Posted June 16, 2011 Posted June 16, 2011 so you have image/imagename.png and want it to go to ?id=image_id?
ExTrEmEDwarf Posted June 16, 2011 Author Posted June 16, 2011 so you have image/imagename.png and want it to go to ?id=image_id? yeah, and generate a small code so the links will be short. But i want em to work in bbcode and html tags. I was using another premium script in the past, i can give you both scripts to check them and if you can make it working i'll give you access on my ftp to do it or via teamviewer.
fdLP. Posted June 16, 2011 Posted June 16, 2011 yeah, and generate a small code so the links will be short. But i want em to work in bbcode and html tags. I was using another premium script in the past, i can give you both scripts to check them and if you can make it working i'll give you access on my ftp to do it or via teamviewer. if your link is for example domain.com/image/imagename.jpg you can change it to domain.com/?id=image_id image_id can be the ID that you have assigned into your database as imagename.jpg you have to show us your code in order to change it.
ExTrEmEDwarf Posted June 16, 2011 Author Posted June 16, 2011 if your link is for example domain.com/image/imagename.jpg you can change it to domain.com/?id=image_id image_id can be the ID that you have assigned into your database as imagename.jpg you have to show us your code in order to change it. Can you pm me to do it? ;D It would be really helpful.
fdLP. Posted June 17, 2011 Posted June 17, 2011 I dont see why not to post here, since its a script not made by you.
ExTrEmEDwarf Posted June 17, 2011 Author Posted June 17, 2011 http://chevereto.googlecode.com/files/chevereto_nb1.91.zip If you manage to do it then tell me your changes cause my script is changed simultaneous times and if i replace any file it will ruin all my work ;D
fdLP. Posted June 17, 2011 Posted June 17, 2011 as i can see from the code which in no way well documented... this script does not store your images in your database so you dont have any ID atm for any image uploaded via this script. So what i would suggest is on file upload connect to your database and store an ID with its filename in a table. Then when a user goes to ?id=image_id you will check against the db and show if there is any image with this ID -------------------------------------- So this is how you do it: create a table called images with 3 fields(if you want to track your users you can add other aswell which i dont cover here) -id INT 11 primary auto increment -image_id INT 11 -image_name TEXT then search for $URLvim = URL_SCRIPT.'?v='.$name; and replace with $URLvim = URL_SCRIPT.'?id='.$image_id; search for } // La funcion and add after it //check if the image id exists $img_id = rand(1000000000, 9999999999); $flag = FALSE; while ($flag==FALSE){ $query = mysql_query("SELECT * FROM images WHERE image_id='$img_id'"); $rows = mysql_num_rows($query); if ($rows==0){ $flag = TRUE; }else{ $img_id = $userf->rand(1000000000, 9999999999); $flag = FALSE; } } if ($flag == true){ mysql_query("INSERT INTO images VALUES ('', '$img_id', '$name')"); $image_id = $img_id; } search for if ($_GET['v']) { and replace with if ($_GET['id']) { below this line change $id = $_GET['v']; to $id = $_GET['id']; search for $v = $_GET['v']; if ($v=='.htaccess') { unset($v); $v=''; } and change it to $v = $_GET['id']; if ($v=='.htaccess') { unset($v); $v=''; } search for if (file_exists($imagen)==true) { till else last bracket and comment the whole if...else... clause and add after //check if ID exists in DB and if it exsits get the name and continue $query = mysql_query("SELECT * FROM images WHERE image_id='$id'"); if (mysql_num_rows($query)){ //image exist $rows = mysql_fetch_array($query); $image_id = $rows["image_id"]; $image_name = $rows["image_name"]; $imagen = DIR_IM.$image_name; $name = $image_name; $titulo = SEEING.' '.$id.' '.AT.' '; $info = getimagesize($imagen); //Obtenemos la informacion $statinfo = @stat($imagen); $ancho = $info[0]; $alto = $info[1]; $mime = $info['mime']; $tamano = $statinfo['size']; //Bytes $tamano_kb = round($tamano*0.0009765625, 2); $canales = $info['channels']; }else{ unset($modo); $modo = 1; $spit = true; $errormsg = NOT_EXISTS; $titulo = NOT_EXISTS_TITLE.ESP_TITULO; } or if you cant make it... send me your engine.php file
Simmo Posted June 21, 2011 Posted June 21, 2011 Wouldn't it just be easier + less code to just have it rename the file depending on the time it was uploaded? or even better, have it name the file depending on a random length string. Or you could always just have the user input the name they want.
ExTrEmEDwarf Posted June 21, 2011 Author Posted June 21, 2011 fdlp did it but my server at before had a software crash and I was trying to restore my files with rescue mode with no success.. so, no reason for this topic to be on since I've lost my files And im open up to new suggestions for my site..
Recommended Posts