{"id":952,"date":"2016-10-11T09:35:17","date_gmt":"2016-10-11T01:35:17","guid":{"rendered":"http:\/\/www.baishitou.cn\/?p=952"},"modified":"2019-01-14T11:10:03","modified_gmt":"2019-01-14T03:10:03","slug":"dedecms%e6%96%87%e7%ab%a0%e5%86%85%e5%ae%b9%e4%b8%ad%e7%9a%84%e5%9b%be%e7%89%87%e8%87%aa%e9%80%82%e5%ba%94%e5%ae%bd%e5%ba%a6%e9%98%b2%e6%ad%a2%e6%92%91%e7%a0%b4%e9%a1%b5%e9%9d%a2","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/952.html","title":{"rendered":"DEDECMS\u6587\u7ae0\u5185\u5bb9\u4e2d\u7684\u56fe\u7247\u81ea\u9002\u5e94\u5bbd\u5ea6,\u9632\u6b62\u6491\u7834\u9875\u9762"},"content":{"rendered":"
\u4f7f\u7528\u8fc7DEDE\u5efa\u7f51\u7ad9\u7684\u670b\u53cb\uff0c\u53ef\u80fd\u90fd\u4f1a\u78b0\u5230\u8fc7\u8fd9\u6837\u7684\u60c5\u51b5\uff0c\u5f53\u6211\u4eec\u5728\u4e00\u4e2a\u7f51\u7ad9\u91cc\u53d1\u8868\u4e00\u7bc7\u6587\u7ae0\u65f6\uff0c\u5982\u679c\u6211\u4eec\u4f7f\u7528\u7684\u56fe\u7247\uff0c\u5176\u5bbd\u5ea6\u8d85\u8fc7\u5185\u5bb9\u533a\u57df\u5927\u5c0f\uff0c\u56fe\u7247\u5c31\u4f1a\u5c06\u8868\u683c\u6491\u5927\uff0c\u540c\u65f6\u4f7f\u5f97\u9875\u9762\u5e03\u5c40\u53d8\u5f97\u6df7\u4e71\u8d77\u6765\u3002\u5f53\u7136\uff0c\u5982\u679c\u61c2CSS\uff0c\u6211\u4eec\u53ef\u4ee5\u5229\u7528css\u6765\u5b9a\u4e49\uff0c\u8ba9\u8d85\u51fa\u7684\u90e8\u5206\u9690\u85cf\u8d77\u6765\u3002\u4e0d\u8fc7\uff0c\u8fd9\u6837\u505a\u7684\u8bdd\uff0c\u56fe\u7247\u7684\u7f8e\u89c2\u6027\u5c31\u5f88\u5dee\uff0c\u663e\u793a\u4e0d\u51fa\u6765\u8d85\u51fa\u7684\u90e8\u5206\u3002<\/p>\n
\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u8fd8\u6709\u4e00\u4e9b\u670b\u53cb\uff0c\u4f1a\u5229\u7528css\uff0c\u4f7f\u56fe\u7247\u5728\u8fc7\u5927\u540e\uff0c\u81ea\u52a8\u5c06\u56fe\u7247\u7f29\u5c0f\uff0c\u4e0d\u8fc7\uff0c\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8eCSS\u5bf9\u5404\u4e2a\u6d4f\u89c8\u5668\u5b58\u5728\u517c\u5bb9\u95ee\u9898\uff0c\u6240\u4ee5\u5c31\u62ffIE6\u6d4f\u89c8\u5668\u6765\u8bf4\uff0c\u5176\u4f5c\u7528\u5c31\u4e0d\u5927\u3002<\/p>\n
\u7b2c\u4e00\u6b65\uff0c\u6253\u5f00include\/arc.archives.class.php<\/p>\n
\u627e\u5230\uff1a<\/p>\n
\/\/\u8bbe\u7f6e\u5168\u5c40\u73af\u5883\u53d8\u91cf\r\n$this->Fields['typename'] = $this->TypeLink->TypeInfos['typename'];\r\n@SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives');\r\n<\/pre>\n\u5728\u4e0b\u9762\u52a0\u5165\u4ee3\u7801\uff1a<\/p>\n
\/\/\u66ff\u6362\u56fe\u7247Alt\u4e3a\u6587\u6863\u6807\u9898\r\n\r\n$this->Fields['body'] = str_ireplace(array('alt=\"\"','alt=\\'\\''),'',$this->Fields['body']);\r\n$this->Fields['body'] = preg_replace(\"@ [\\s]{0,}alt[\\s]{0,}=[\\\"'\\s]{0,}[\\s\\S]{0,}[\\\"'\\s]\r\n@isU\",\" \",$this->Fields['body']);\r\n$this->Fields['body'] = str_ireplace(\"<img \" ,\"<img alt=\\\"\".$this->Fields['title'].\"\\\"\r\n\",$this->Fields['body']);\r\n\r\n\/\/img\u6807\u7b7e\u4e2d\u52a0\u5165\u8d85\u5bbd\u7f29\u5c0fJS\u8c03\u7528\u4ee3\u7801\r\n\r\n$suolue='onload=\"javascript:ImgReSize(this)\"';\r\n$this->Fields['body'] = str_ireplace(\"<img \" ,\"<img \".$suolue.\" \",$this->Fields['body']);\r\n\/\/\u5c4f\u853dheight\u5c5e\u6027\r\n$this->Fields['body'] = preg_replace('\/<img(.+?)height=(.+?) (.+?)>\/i',\"<img$1$3>\",$this->Fields['body']);\r\n<\/pre>\n\u7b2c\u4e8c\u6b65\uff1a\u6253\u5f00\u4f60\u524d\u53f0\u6587\u7ae0\u9875\u6a21\u7248 \u9ed8\u8ba4\u7684\u662f\uff1a\/templets\/default\/article_article.htm (\u6709\u7684\u670b\u53cb\uff0c\u4eff\u5b8c\u7ad9\uff0c\u5185\u5bb9\u9875\u7684\u6a21\u7248\u672a\u5fc5\u662f\u8fd9\u4e2a\u9ed8\u8ba4\u7684)\u6253\u5f00\u6a21\u7248\u540e\u5c06\u4e0b\u9762\u4ee3\u7801\u63d2\u5165\u5230 \u4e2d \uff0c\u6ce8\u610f\u90a3\u4e2a670\u7684\u6570\u503c\uff0c\u8fd9\u4e2a\u503c\u610f\u601d\u662f\u5f53\u56fe\u7247\u8d85\u8fc7\u8fd9\u4e2a\u6570\u503c\uff0c\u81ea\u52a8\u5c06\u56fe\u7247\u7f29\u5c0f\uff0c\u5bbd\u5ea6\u7f29\u5c0f\u4e3a670\uff0c\u9ad8\u5ea6\u81ea\u52a8\u6309\u6bd4\u4f8b\u7f29\u5c0f\uff0c\u8fd9\u6837\u4e0d\u4f1a\u53d8\u578b\u3002<\/p>\n
<script language='javascript'>\r\nfunction ImgReSize(e)\r\n{\r\nif(e.width>670) \/\/ 670\u53ef\u6839\u636e\u4f60\u6587\u7ae0\u7684\u5185\u5bb9\u533a\u57df\u5927\u5c0f\uff0c\u53ef\u8c03\u6574\r\n{\r\ne.width=670; \/\/ \u7b49\u540c\u4e0a\u9762\u4f60\u8bbe\u7684\u90a3\u4e2a\u6570\u503c\r\ne.style.width=\"\";\r\n}\r\nif(e.height>10)\r\n{\r\ne.style.height=\"\";\r\n}\r\n}\r\n<\/script>\u00a0<\/code><\/pre>\n
<\/p>\n
\u5230\u8fd9\u91cc\uff0c\u5c31\u5b8c\u6d3b\u4e86\uff0c\u5982\u679c\u4f60\u61c2CSS\u6700\u597d\u627e\u5230 \u5185\u5bb9\u533a\u57df\u7684CSS\uff0c\u5c06\u5b83\u7684\u5bbd\u8bbe\u5b9a\u597d\uff0c\u7136\u540e\u5b9a\u4e49\u4e00\u4e0b\uff0c\u8d85\u51fa\u90e8\u5206\u9690\u85cf\uff0c\u56e0\u4e3a\u6709\u65f6\u5019\uff0c\u6587\u7ae0\u5728\u52a0\u8f7d\u7684\u8fc7\u7a0b\u4e2d\uff0c\u663e\u793a\u7684\u662f\u4f60\u539f\u59cb\u5927\u5c0f\uff0c\u52a0\u8f7d\u5b8c\u6210\u540e\uff0cJS\u624d\u4f1a\u8d77\u4f5c\u7528\uff0c\u5c06\u56fe\u7247\u7f29\u5c0f\u3002<\/p>\n
<\/p>\n
\u524d\u51e0\u5929\u9047\u5230\u4e00\u4e2a\u95ee\u9898\uff0c\u56fe\u7247\u8d85\u51fa\u4e86\u9875\u9762\u3002\u6e05\u9664\u6d6e\u52a8\uff0c\u8d85\u51fa\u9690\u85cf\u90fd\u4e0d\u8d77\u4f5c\u7528\uff0c\u7ed9\u56fe\u7247\u52a0\u4e0a\u4e0b\u9762\u6837\u5f0f\u540e\u6b63\u5e38\u3002<\/p>\n
\u8bbe\u7f6e\u5185\u5bb9\u56fe\u7247\u6837\u5f0f\uff1a<\/p>\n
.article img {\r\n display: block;\r\n max-width: 100%;\r\n margin: auto\r\n}<\/code><\/pre>\n
\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n