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 chaquopy python 安卓
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题