Dss.Lexius Posted June 17, 2010 Share Posted June 17, 2010 Hi, So, here is the code. <?php $image_get[0] = "http://nstoia.com/grs/easyalbum/images/adrian.jpg"; $image_get[1] = "http://nstoia.com/grs/easyalbum/images/beverly.jpg"; $image_get[2] = "http://nstoia.com/grs/easyalbum/images/dog.jpg"; $image_get[3] = "http://nstoia.com/grs/easyalbum/images/group.jpg"; $image_get[4] = "http://nstoia.com/grs/easyalbum/images/kids.jpg"; $image_get[5] = "http://nstoia.com/grs/easyalbum/images/kenny.jpg"; $count = count($image_get); $i=0; while($i<$count) { $image_save = substr(strrchr($image_get[$i], "/"), 1); $image = file_get_contents($image_get[$i]); $f = fopen($image_save,'w+'); fwrite($f,$image); fclose($f); $i++; } ?> i got this code from this forum, credits to original author. using this code we can download some image files and save them on the server. but i want to edit something in it. i want images to be saved with different name (Always some random characters) For example these images should be saved as A911.jpg 5ctc.jpg xxx7.gif This is just a example ^ First i was using a computer program written by me, but now to automate and make my work easy i want to use online server. on my computer i used the following function to get random chracters: Func __GetRandomChars($p_sLen = 4) Local $L_sRand = "" For $l_ia = 0 To ($p_sLen -1) Switch( Random(0 , 1 , 1 ) ) Case 1 $L_sRand &= Chr(Random(Asc("a"), Asc("f"), 1)) Case 0 $L_sRand &= Random(0, 9, 1) EndSwitch Next Return $L_sRand EndFunc and then downloaded and saved the file using this piece of code: InetGet($file01, $destination & "\" & __GetRandomChars() & ".gif", 1, 1) but for making my work more easy, fast and automated, i want everything to be done on a online server. for this plz help me... Thanx Link to comment https://forums.phpfreaks.com/topic/205050-aways-save-as-a-random-different-name/ Share on other sites More sharing options...
Mchl Posted June 17, 2010 Share Posted June 17, 2010 md5/md5_file() Link to comment https://forums.phpfreaks.com/topic/205050-aways-save-as-a-random-different-name/#findComment-1073412 Share on other sites More sharing options...
Dss.Lexius Posted June 17, 2010 Author Share Posted June 17, 2010 Quote md5/md5_file() don't you think it causes high cpu load because there 'll be many files on seconds basis. Link to comment https://forums.phpfreaks.com/topic/205050-aways-save-as-a-random-different-name/#findComment-1073418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.