예제 #1
0
 protected static function get_location(\Album\Model_AlbumImage $obj)
 {
     if (!($file = \Model_File::get4name($obj->file_name))) {
         return false;
     }
     if (!$file->exif) {
         return false;
     }
     $exif = unserialize($file->exif);
     return \Util_Exif::get_location($exif);
 }
예제 #2
0
 protected function save_file($file, $exif = array())
 {
     $model_file_name = $this->options['is_tmp'] ? '\\Model_FileTmp' : '\\Model_File';
     $model_file = $model_file_name::forge();
     $model_file->name = $this->options['filename_prefix'] . $file->name;
     $model_file->filesize = $file->size;
     $model_file->type = $file->type;
     $model_file->original_filename = $file->original_name;
     if ($this->options['member_id']) {
         $model_file->member_id = $this->options['member_id'];
     }
     $model_file->user_type = $this->options['user_type'];
     if ($exif) {
         $model_file->exif = serialize($exif);
         if ($exif_time = Util_Exif::get_original_datetime($exif)) {
             $model_file->shot_at = $exif_time;
         }
     }
     if (!$model_file->save()) {
         throw new \FuelException('Failed to save file.');
     }
     return $model_file->id;
 }
예제 #3
0
파일: upload.php 프로젝트: uzura8/flockbird
 /**
  * @dataProvider test_convert2decimal_geolocation_provider
  */
 public function test_convert2decimal_geolocation($ref, $decimal60_values, $expected = null)
 {
     $test = Util_Exif::convert2decimal_geolocation($ref, $decimal60_values);
     $this->assertEquals($expected, $test);
 }
예제 #4
0
 protected function save_model_file($exif)
 {
     $model_file = new \Model_File();
     $model_file->name = $this->file->name;
     $model_file->filesize = $this->file->size;
     $model_file->type = $this->file->type;
     $model_file->original_filename = $this->file->original_name;
     $model_file->member_id = $this->options['member_id'];
     if ($exif) {
         $model_file->exif = serialize($exif);
         if ($exif_time = Util_Exif::get_original_datetime($exif)) {
             $model_file->shot_at = $exif_time;
         }
     }
     if (!$model_file->shot_at) {
         $model_file->shot_at = date('Y-m-d H:i:s');
     }
     $model_file->save();
     $this->file->id = $model_file->id;
     $this->file->shot_at = $model_file->shot_at;
 }