07-20-2006, 08:02 AM
|
#1 (permalink)
|
|
Junior Member
Join Date: Jul 2006
Posts: 1
|
finding scripts
so im looking for a php script that friends of mine can come and upload picture to my server. then they could be displayed in a thumb gallery.
does anyone know of any good places to find a script that could do this?
|
|
|
07-22-2006, 12:54 PM
|
#2 (permalink)
|
|
Junior Member
Join Date: Jul 2006
Posts: 11
|
Re: finding scripts
for this one you need a mysql database
coppermineDOTsfDOTnet
this one is just php
galleryDOTmenaltoDOTcom
i hope this was helpfull (please replace the DOT with a . because of the restrictions of this forum i could not post the link)
|
|
|
08-04-2006, 05:38 AM
|
#3 (permalink)
|
|
Junior Member
Join Date: Jun 2006
Posts: 28
|
Re: finding scripts
I made something like this recently.
This is from http://plurged.com/code.php?id=82
PHP Code:
function uploadfile($origin, $dest, $tmp_name) { $origin = strtolower(basename($origin)); $fulldest = $dest.$origin; $filename = $origin; for ($i=1; file_exists($fulldest); $i++) { $fileext = (strpos($origin,'.')===false?'':'.'.substr(strrchr($origin, "."), 1)); $filename = substr($origin, 0, strlen($origin)-strlen($fileext)).'['.$i.']'.$fileext; $fulldest = $dest.$newfilename; } if (move_uploaded_file($tmp_name, $fulldest)) return $filename; return false; }
//example: uploadfile($_FILE['file']['name'],'temp/',$_FILE['file']['tmp_name']);
And then use a database to store the picture urls or use this code that I typed up recently (create vars.txt with good permissions):
PHP Code:
<?
//variable functions function getVar($variablename){ //get the contents of the file $variabledatabase = file_get_contents("../forums/vars.txt"); //find the value of the variable: $variablea = split(" ", $variabledatabase); $return = false; foreach($variablea as $variablec){ $variableb = split('\$', $variablec); if($variableb[1] == $variablename){ $return = $variableb[2]; } $i++; } return $return; }
function newVar($variablenamenew, $variablecontentsnew){ if(!getVar($variablenamenew) && getVar($variablenamenew) !== ""){ //if the variable doesn't exist //add a new one $hnew = fopen("../forums/vars.txt", "a"); $allvarnew = "\$".$variablenamenew."\$".$variablecontentsnew." "; fwrite($hnew, $allvarnew); fclose($hnew); return true; } else return false; }
function setVar($variablenameset, $variablecontentsset){ if(getVar($variablenameset) || getVar($variablenameset) === ""){ //if the variable exists //get the contents of the file $varstxtcontents = file_get_contents("../forums/vars.txt"); //change the variable $varstxtcontentsa = split('\$', $varstxtcontents); $j = 1; while($j<sizeof($varstxtcontentsa)){ if($varstxtcontentsa[$j] == $variablenameset){ $j++; $varstxtcontentsa[$j] = $variablecontentsset." "; $j--; } $j = $j + 2; } $variablecontentssetb = join("\$", $varstxtcontentsa); //actually write the new file $hsetw = fopen("../forums/vars.txt", "w"); fwrite($hsetw, $variablecontentssetb); fclose($hsetw); return true; } else return false; }
function delVar($varnamedel){ if(getVar($varnamedel) || getVar($varnamedel) === ""){ //if the variable exists //get the contents $contentsdel = file_get_contents("../forums/vars.txt"); //find and remove the variable $contentsdeli = 1; $contentsdel1 = split('\$', $contentsdel); while($contentsdeli < sizeof($contentsdel1)){ if($contentsdel1[$contentsdeli] == $varnamedel){ array_splice($contentsdel1, $contentsdeli, 2); //where it's actually removed $contentsdeli -= 2; } $contentsdeli += 2; } //put it back together $contentsdel1 = join("\$", $contentsdel1); //write it! $delh = fopen("../forums/vars.txt", "w"); fwrite($delh, $contentsdel1); fclose($delh); return true; } else return false; }
?>
|
|
|
08-04-2006, 02:14 PM
|
#4 (permalink)
|
|
Moderator Of The Year
Join Date: Jul 2006
Location: Cali Breeze
Posts: 716
|
Re: finding scripts
Good Post Shane,
i dont have the time to test it, but SHZ if you do let me know how it works
~Snapple
|
|
|
08-06-2006, 03:56 AM
|
#5 (permalink)
|
|
Junior Member
Join Date: Aug 2006
Posts: 11
|
Re: finding scripts
Thank You All
Congratulation
|
|
|
08-06-2006, 04:45 AM
|
#6 (permalink)
|
|
Junior Member
Join Date: Jun 2006
Posts: 28
|
Re: finding scripts
fares_refaat, that's the third time that you have thanked instead of the originator of the thread! What's the deal? But, you're welcome!
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00
|
|
|
|
|