duanpu6319 2016-08-20 12:03
浏览 29
已采纳

获取Thumb webservice使用PHP codeigniter [关闭]

I created webservice for gallery as category.

Each image gallery should have count and main cover photo.

I need help creating the main photo from each gallery and I believe that is should last image should be main.

My webservice for image gallery category as below :

    /* Get galleries*/

public function get_galleries($db) {
    $operation = new Operations($db);
    $galleries = $operation->GetResultsWebServiceGallery("Select galID as 'id', galTitle, galLocation,galDescription from  " . $db . ".hotshoe_gallery");
    foreach ($galleries as $key => $value) {
       if(!empty($galleries[$key]['id'])) {
        $id = $galleries[$key]['id'];
           $galleries[$key]['count'] = $operation->GetResults("Select COUNT(*) as total from  " . $db . ".hotshoe_images where galID=$id");
       }
    }
    return $galleries;
}
  • 写回答

1条回答 默认 最新

  • dragon8899 2016-08-20 14:54
    关注

    Fetch one image from each gallery and use it as cover.

     /* Get gallries*/
    
    public function get_galleries($db) {
        $operation = new Operations($db);
        $galleries = $operation->GetResultsWebServiceGallery("Select galID as 'id', galTitle, galLocation,galDescription from  " . $db . ".hotshoe_gallery");
        foreach ($galleries as $key => $value) {
           if(!empty($galleries[$key]['id'])) {
            $id = $galleries[$key]['id'];
               $galleries[$key]['count'] = $operation->GetResults("Select COUNT(*) as total from  " . $db . ".hotshoe_images where galID=$id");
               //my code start here
               $galleries[$key]['cover'] = $operation->GetResults("Select image  from  " . $db . ".hotshoe_images where galID=$id order by id desc limit 1");
              //my code ends here
    
           }
        }
        return $galleries;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥88 用uniapp写一个多端的程序,用到高德地图,用高德的JSAPI吗?
  • ¥20 关于#c++#的问题:水果店管理系统
  • ¥30 dbLinq最新版linq sqlite
  • ¥20 对D盘进行分盘之前没有将visual studio2022卸载掉,现在该如何下载回来
  • ¥15 完成虚拟机环境配置,还有安装kettle
  • ¥15 2024年全国大学生数据分析大赛A题:直播带货与电商产品的大数据分析 问题5. 请设计一份优惠券的投放策略,需要考虑优惠券的数量、优惠券的金额、投放时间段和投放商品种类等因素。求具体的python代码
  • ¥15 有人会搭建生鲜配送自营+平台的管理系统吗
  • ¥15 用matlab写代码
  • ¥30 motoradmin系统的多对多配置
  • ¥15 求组态王串口自定义通信配置方法或代码?