Пример #1
0
Файл: Post.php Проект: rjha/sc
 static function getImageOrDefault($json)
 {
     $images = json_decode($json);
     $imgv = array();
     if (!empty($images) && sizeof($images) > 0) {
         //work with image #1
         $image = $images[0];
         $imgv = self::convertImageJsonObj($image);
         $td = Util::foldXY($image->width, $image->height, 40, 40);
         $imgv["twidth"] = $td["width"];
         $imgv["theight"] = $td["height"];
     } else {
         $imgv["name"] = "placeholder";
         $imgv["tname"] = "placeholder";
         $imgv["source"] = UIConstants::PH1_PIC;
         $imgv["thumbnail"] = UIConstants::PH1_PIC;
         $imgv["width"] = 48;
         $imgv["height"] = 48;
         $imgv["twidth"] = 40;
         $imgv["theight"] = 40;
     }
     return $imgv;
 }