Internal optimisations and additional flags for Photo/Video
This commit is contained in:
@@ -22,33 +22,7 @@ class Photo extends Abstracted\Catalog
|
||||
|
||||
public function getIDLinkAttribute()
|
||||
{
|
||||
return $this->HTMLLinkAttribute($this->id,url('p/info').'/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Date the photo was taken
|
||||
*/
|
||||
public function date_taken(): string
|
||||
{
|
||||
return $this->date_created
|
||||
? ($this->date_created->format('Y-m-d H:i:s').($this->subsectime ? '.'.$this->subsectime : ''))
|
||||
: 'UNKNOWN';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the new name for the image
|
||||
*/
|
||||
public function file_path($short=FALSE,$new=FALSE)
|
||||
{
|
||||
$file = $this->filename;
|
||||
|
||||
if ($new)
|
||||
$file = sprintf('%s.%s',((is_null($this->date_created) OR ! $this->date_created)
|
||||
? sprintf('UNKNOWN/%07s',$this->file_path_id())
|
||||
: sprintf('%s_%03s',$this->date_created->format('Y/m/d-His'),$this->subsectime).
|
||||
($this->subsectime ? '' : sprintf('-%05s',$this->id))),$this->type());
|
||||
|
||||
return (($short OR preg_match('/^\//',$file)) ? '' : config('photo.dir').DIRECTORY_SEPARATOR).$file;
|
||||
return $this->HTMLLinkAttribute($this->id,'p/info');
|
||||
}
|
||||
|
||||
public function getHtmlImageURL(): string
|
||||
@@ -169,10 +143,6 @@ class Photo extends Abstracted\Catalog
|
||||
return $this->o() ? $this->_o->getImageProperties() : [];
|
||||
}
|
||||
|
||||
public function setDateCreated()
|
||||
{
|
||||
$this->date_created = $this->property('creationdate');
|
||||
}
|
||||
|
||||
public function setLocation()
|
||||
{
|
||||
@@ -202,15 +172,9 @@ class Photo extends Abstracted\Catalog
|
||||
$this->software_id = $so->id;
|
||||
}
|
||||
|
||||
public function setSignature()
|
||||
public function setSubSecTime(): int
|
||||
{
|
||||
$this->signature = $this->property('signature');
|
||||
$this->file_signature = md5_file($this->file_path());
|
||||
}
|
||||
|
||||
public function setSubSecTime()
|
||||
{
|
||||
$this->subsectime = $this->property('exif:SubSecTimeOriginal');
|
||||
$this->subsectime = (int)$this->property('exif:SubSecTimeOriginal');
|
||||
|
||||
// In case of an error.
|
||||
if ($this->subsectime > 32767)
|
||||
@@ -240,7 +204,7 @@ class Photo extends Abstracted\Catalog
|
||||
public function thumbnail($rotate=TRUE)
|
||||
{
|
||||
if (! $this->thumbnail) {
|
||||
if ($this->o()->thumbnailimage(200,200,true,false)) {
|
||||
if ($this->isReadable() AND $this->o()->thumbnailimage(200,200,true,false)) {
|
||||
$this->_o->setImageFormat('jpg');
|
||||
return $this->_o->getImageBlob();
|
||||
|
||||
|
Reference in New Issue
Block a user