Skip to content

调用素材资源

素材管理库中的图片、视频的调用方法是 get_thumb_images 参数 $site_id 站点id $image 图片的URL,数据库表url字段 $thumb_type 获取的图片的缩略图尺寸 ,默认值为all 会把大图,中图,小图都返回

数据字典中定义 FileDict const BIG = 'big'; const MID = 'mid'; const SMALL = 'small'; 当值为all , 会返回数组结构 [ 'big' =>, 'mid' =>, 'small' => , ] 值为 big,mid,small值,直接返回图片的途径(本地或者云服务器)

开发时,都需要在后端查询图片的路径,返回给前端,前端根据路径加载图片

php
/**
 * 获取缩略图
 * @param $site_id
 * @param $image
 * @param $thumb_type
 * @return mixed
 * @throws Exception
 */
function get_thumb_images($site_id, $image, $thumb_type = 'all', bool $is_throw_exception = false){

    return (new CoreImageService())->thumb($site_id, $image, $thumb_type, $is_throw_exception);
}

基于 MIT 协议发布