/**
* {@inheritdoc}
*/
public function insertImage($publicKey, $imageIdentifier, Image $image)
{
$now = time();
if ($added = $image->getAddedDate()) {
$added = $added->getTimestamp();
}
if ($updated = $image->getUpdatedDate()) {
$updated = $updated->getTimestamp();
}
if ($id = $this->getImageId($publicKey, $imageIdentifier)) {
return (bool) $this->getConnection()->update($this->tableNames['imageinfo'], array('updated' => $now), array('id' => $id));
}
return (bool) $this->getConnection()->insert($this->tableNames['imageinfo'], array('size' => $image->getFilesize(), 'publicKey' => $publicKey, 'imageIdentifier' => $imageIdentifier, 'extension' => $image->getExtension(), 'mime' => $image->getMimeType(), 'added' => $added ?: $now, 'updated' => $updated ?: $now, 'width' => $image->getWidth(), 'height' => $image->getHeight(), 'checksum' => $image->getChecksum(), 'originalChecksum' => $image->getOriginalChecksum()));
}