public static function get_bin_from_storage($filename, $strage_type = null, $upload_type = 'img') { if (!$strage_type) { $strage_type = conf('upload.storageType'); } if (!in_array($strage_type, array('db', 'S3'))) { throw new InvalidArgumentException('Second parameter is invalid.'); } return $strage_type == 'db' ? Model_FileBin::get_bin4name($filename) : file_get_contents(Site_S3::get_url($filename, $upload_type)); }