示例#1
0
 /**
  * 中介图片地址拼接
  * @param $hostid	图片hostid
  * @param $filename	图片地址
  * @param $flg		old:images1 ; new:pic1
  * @params int $brokerid 在pic域名下的房源图片打印经纪人名水印
  */
 public static function get_dfs_url($hostid, $filename, $flg = 'new', $brokerid = '')
 {
     if ('new' == $flg) {
         // Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain()
         $img_domain = APF::get_instance()->get_config("pic_server_domain");
         //$base_domain	= APF::get_instance()->get_config("pic_server_base_domain");
         $base_domain = Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain();
         $filename = preg_replace("/(.*)(display)(.*)/", '$1display/hz$3', $filename);
     } elseif ('old' == $flg) {
         $img_domain = APF::get_instance()->get_config("ajk_image_server_domain", 'ajkconfig');
         $base_domain = APF::get_instance()->get_config("ajk_image_server_base_domain", 'ajkconfig');
         $base_domain = substr($base_domain, 1);
         $filename = preg_replace('/(http:\\/\\/.*\\/)?(property|community)(.*)/', '$1haozu/$2$3', $filename);
     }
     $url = "http://" . $img_domain . $hostid . "." . $base_domain . "/" . $filename;
     if ($brokerid && 'new' == $flg) {
         $url = preg_replace("/(.*)(display)\\/(.*)\\/(.*)/", '$1display/$3_' . $brokerid . '/$4', $url);
     }
     return $url;
 }
示例#2
0
 /**
  * @param $images
  * @return array
  */
 public static function buildImagesForPage($images)
 {
     $picData = array('UPDROOM' => array(), 'ALLMODEL' => array(), 'ALLCOMM' => array(), 'defaultImgID' => 0);
     if (empty($images)) {
         return $picData;
     }
     $defaultImgID = 0;
     foreach ($images as $img) {
         $ajkcid = intval($img['ajkcid']);
         //$params['upload_imgs'][] = $ajkcid . '*' . $img['type'] . '*' . $img['hostid'] . '*' . $img['imageid'];
         if ($ajkcid > 0) {
             $s_src = Bll_Image_UtilsImage::show_a_img_size($img['hostid'], $img['imageid'], $ajkcid, 'small');
         } else {
             $s_src = 'http://pic' . $img['hostid'] . '.' . Bll_Image_HzHouseImage::getGenerateImgUrlBaseDomain() . '/display/hz/' . $img['imageid'] . '/100x75c.jpg';
         }
         if ($img['type'] == 1) {
             $prefix = 'UPDROOM';
         } elseif ($img['type'] == 2) {
             $prefix = 'ALLMODEL';
         } else {
             $prefix = 'ALLCOMM';
         }
         $tmp = array('AID' => $img['imageid'], 'url' => $s_src, 'type' => $img['type'], 'commId' => $ajkcid ? $ajkcid : 0, 'imageId' => $img['imageid'], 'ajkCid' => $ajkcid, 'isDefault' => $img['default'], 'hostId' => $img['hostid']);
         // 模拟上传参数
         if ($img['ajkcid'] > 0) {
             $tmp = array_merge($tmp, array('commPicId' => $img['ajkcid']));
         } else {
             $tmp = array_merge($tmp, array('id' => $img['imageid'], 'hash' => $img['hostid'], 'host' => $img['hostid'], 'exists' => $img['md5_exists'], 'exif' => serialize(array('copyright' => $img['exif_exists']['copyright'], 'dateTime' => $img['exif_exists']['dateTime'], 'fileDateTime' => $img['exif_exists']['fileDateTime'], 'fileSize' => $img['exif_exists']['fileSize'], "make" => $img['exif_exists']['make'], "model" => $img['exif_exists']['model'], "memo" => "", "mimeType" => $img['exif_exists']['mimeType'], "software" => $img['exif_exists']['software'], "xResolution" => $img['exif_exists']['xResolution'], "yResolution" => $img['exif_exists']['yResolution']))));
         }
         $picData[$prefix][] = $tmp;
         if ($img['default']) {
             $defaultImgID = $img['imageid'];
         }
     }
     $picData['defaultImgID'] = $defaultImgID;
     return $picData;
 }