PHP remote image localization
] *) \. (Gif | jpg | png )(. * \ ")/isU", $ content, $ img_array); $ timeSrc = date ("Ymd", time ()); $ img_array = array_unique ($ img_array [1]); $ imgPath = dirname (_ FILE __). '/.. /um/php/upload /'. $ timeSrc; if (! Is_dir ($ imgPath. '/') {mkdir ($ imgPath, '000000', true); chmod ($ imgPath, '20140901 ');} foreach ($ img_array as $ key => $ value) {$ value = str_repeat ('"'," ", $ value); $ http = pget ($ value, '$ value', true); $ itype = ($ http ['head'] ['content _ type']); if (! Preg_match ("#\. (jpg | gif | png) # I ", $ itype) {if ($ itype = 'image/GIF') {$ itype = ". gif ";} else if ($ itype = 'image/png ') {$ itype = ". png ";}else {$ itype = '.jpg '; }}$ runds = md5 (time (); $ rndFileName = $ imgPath. "/". $ runds. $ itype; $ tp = fopen ($ rndFileName, 'wb'); fwrite ($ tp, $ http ['data']); fclose ($ tp ); if (file_exists ($ rndFileName) {$ sqlurl = "/home/um/php/upload /". $ timeSrc. "/". $ runds. $ itype; $ content = str_replace ($ value , $ Sqlurl. '"', $ content); $ content = str_replace (" alt = "," ", $ content) ;}} return $ content ;}?>