Example #1
0
 protected function imageMetaCreate(&$cur, $f, $id)
 {
     $file = $this->pwd . '/' . $f;
     if (!file_exists($file)) {
         return false;
     }
     $xml = new xmlTag('meta');
     $meta = imageMeta::readMeta($file);
     $xml->insertNode($meta);
     $c = $this->core->con->openCursor($this->table);
     $c->media_meta = $xml->toXML();
     if ($cur->media_title !== null && $cur->media_title == basename($cur->media_file)) {
         if ($meta['Title']) {
             $c->media_title = $meta['Title'];
         }
     }
     if ($meta['DateTimeOriginal'] && $cur->media_dt === '') {
         # We set picture time to user timezone
         $media_ts = strtotime($meta['DateTimeOriginal']);
         if ($media_ts !== false) {
             $o = dt::getTimeOffset($this->core->auth->getInfo('user_tz'), $media_ts);
             $c->media_dt = dt::str('%Y-%m-%d %H:%M:%S', $media_ts + $o);
         }
     }
     $c->update('WHERE media_id = ' . $id);
 }