现在做个上传APK格式功能 , 想在APK上传到服务器之后将APK截图并返回到游览器 有知道怎么实现的吗 参考http://dev.appchina.com/et/dev/upload_up.action 这网站就有这个功能 怎么搞的?

解决方案 »

  1.   

    运行apk是要jdk androidsdk环境的,就算把apk作为zip包处理,能不能获取里面的缩略图也另说呢,为什么不在上传apk时同时上传一个缩略图呢
      

  2.   

    找到方法了 查了下资料 原来APK实际上是ZIP压缩包格式 这就好办了 可以直接读取里面的资源文件 附上临时代码.-----------
    $zip_file = dirReplace(BF_ROOT . '/upload/tmp/' .self::$LoginObject->rtnUserInfo('userid') . '/pik/' . $this->get('no'));
            $icon_file = dirReplace(BF_ROOT . '/upload/tmp/' .self::$LoginObject->rtnUserInfo('userid') . '/pik/icon.png');
            //-------
            $zip = zip_open($zip_file);
            if ($zip) {
                while ($zip_entry = zip_read($zip)) {  
                $file_name=zip_entry_name($zip_entry);  
                if(str_exists($file_name, 'drawable-xhdpi/icon.png'))  
                    if (zip_entry_open($zip, $zip_entry, "r")) {  
                        /* read binary stream */  
                        $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));                      
                        /* create temporary bmpImg */  
                        if($fp = fopen($icon_file,'w'))  
                        {    
                            if(fwrite($fp,$buf))  
                            {    
                                 fclose($fp);        
                            }    
                        }    
                        zip_entry_close($zip_entry);  
                    }  
            }  
            zip_close($zip);  
         }  
           echo file_get_contents($icon_file);