Ejemplo n.º 1
0
Archivo: Image.php Proyecto: pdyn/image
 /**
  * Get image EXIF information.
  *
  * @return array Array of EXIF data.
  */
 public function get_exif()
 {
     $return = [];
     set_error_handler(function () {
     });
     try {
         if (extension_loaded('exif') && $this->mime === 'image/jpeg') {
             $exif = exif_read_data($this->filename);
             $return = array_merge($exif, $return);
             if (isset($exif['Orientation']) && in_array($exif['Orientation'], [1, 2, 3, 4, 5, 6, 7, 8])) {
                 $return['orientation'] = (int) $exif['Orientation'];
             }
             if (isset($exif['FileDateTime']) && \pdyn\datatype\Validator::timestamp($exif['FileDateTime']) === true) {
                 $return['timestamp'] = (int) $exif['FileDateTime'];
             }
             if (!empty($exif['FileName']) && \pdyn\datatype\Validator::filename($exif['FileName']) === true) {
                 $return['filename'] = (string) $exif['FileName'];
             }
         }
     } catch (\Exception $e) {
         $return = [];
     }
     restore_error_handler();
     return $return;
 }
Ejemplo n.º 2
0
Archivo: User.php Proyecto: pdyn/user
 /**
  * Insert data into the object's database table.
  *
  * @param array $info Array of object data, with database column names as keys.
  * @return int|false The auto-generated record ID or false if failure.
  */
 protected function db_insert($info)
 {
     if (empty($info['timecreated']) || \pdyn\datatype\Validator::timestamp($info['timecreated']) !== true) {
         $info['timecreated'] = time();
         $this->timecreated = $info['timecreated'];
     }
     if (empty($info['timeupdated']) || \pdyn\datatype\Validator::timestamp($info['timeupdated']) !== true) {
         $info['timeupdated'] = time();
         $this->timeupdated = $info['timeupdated'];
     }
     return parent::db_insert($info);
 }