该问题已被锁定!
6
关注
3077
浏览

怎么调用问题或文章附件里的图片,来做封面

AI智能回复搜索中,请稍后...

为什么被折叠? 0 个回复被折叠
sl514 中级会员 用户来自于: 江苏省苏州市
2015-03-13 12:54
function catch_that_image($message) { //$message为文章内容
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/[\'"]([^\'"]+)[\'"].*>/i', $message, $matches);  //正则匹配文章中所有图片
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //定义默认图片
    $first_img = "/images/default.jpg";  //默认图片地址需自己设置
  }
  return $first_img;
}

关于作者

问题动态

发布时间
2015-03-13 11:08
更新时间
2015-03-13 12:54
关注人数
6 人关注

推荐内容

× WeCenter 至少需要有 GD 图象处理库才能正常运行 FreeType 支持× WeCenter 的验证码需要 FreeType 支持
问个问题,如果附件表里有五百万以上数据,那网站还能活么。。。
关于 WeCenter 升级问题,直接跳到了安装界面
后台-内容管理Template error, template file not found
子目录的地址问题
请问怎么设置STMP,为什么设置了,还是无法成功发送邮件
WeCenter 2.1 正式版发布!
wecenter负载怎么样
wecenter登录时,密码加密方式是什么?
乐视云点播插件