|
首先找到 require/postnew.php 然后找到- $db->update("INSERT INTO $pw_tmsgs
复制代码
在上面一行回车几下,插入如下代码- $config_save_url_img = true;
- if ($config_save_url_img)
- {
- function SaveUrlImg($sourceUrl,$objectFile = "")
- {
- global $db_attachname;
- $objectPath = $db_attachname."/".date("Ym")."/";
- if (empty($objectFile))
- {
- $objectFile = md5($sourceUrl).".jpg";
- }
- ob_start();
- @readfile($sourceUrl);
- $img=ob_get_contents();
- ob_end_clean();
- if (!empty($objectPath) && !is_dir($objectPath))
- {
- @mkdir($objectPath, 0777);
- }
- $objectFile = $objectPath.$objectFile;
- $fp=@fopen($objectFile,"a");
- fwrite($fp,$img);
- fclose($fp);
- return$objectFile;
- }
- preg_match_all("/(\\[img\\](http\\:\\/\\/[^\\[]*)\\[\\/img\\])/",$atc_content,$urlImgArr);
- if (!empty($urlImgArr[2]))
- {
- foreach ($urlImgArr[2] as $k=>$v)
- {
- $tempNameArr[$k] = SaveUrlImg($v);
- }
- $atc_content = str_replace($urlImgArr[2], $tempNameArr, $atc_content);
- }
- }
复制代码 搞定,
这个设置比较适用于服务器空间比较大的人使用。 |
|