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;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器