public function insert() { $this->set('pretty_date', Transform_Text::rudate()); $this->set('sortdate', ceil(microtime(true) * 1000)); $this->set('area', def::area(1)); parent::insert(); return $this; }
public function insert() { if (!Check::is_hash($this->get('md5')) || !Check::is_hash($this->get('thumb')) || !$this->get('extension') || Database::get_count('art', 'md5 = ?', $this->get('md5'))) { return $this; } if ($this->get('resized') == 1) { $this->calculate_resize(); } $this->set('pretty_date', Transform_Text::rudate()); $this->set('sortdate', ceil(microtime(true) * 1000)); if (!$this->get('area')) { $this->set('area', def::area(1)); } $this->correct_tags(); parent::insert(); if (function_exists('puzzle_fill_cvec_from_file') && function_exists('puzzle_compress_cvec')) { $imagelink = IMAGES . SL . 'booru' . SL . 'thumbs' . SL . 'large_' . $this->get('thumb') . '.jpg'; $vector = puzzle_fill_cvec_from_file($imagelink); $vector = base64_encode(puzzle_compress_cvec($vector)); Database::insert('art_similar', array('id' => $this->get_id(), 'vector' => $vector)); } return $this; }