/** * initialisiert Bild-Objekt * @param bool $initDB * @return boolean */ protected function init($initDB) { if ($initDB) { $dbData = $this->dbcon->fetch($this->dbcon->select($this->table, 'id, smileycode, filename', "smileycode " . $this->dbcon->dbLike() . " ?", array($this->smileycode))); if (!$dbData) { return false; } foreach ($dbData as $key => $value) { $this->{$key} = $value; } } if (parent::exists()) { $fileData = getimagesize($this->fullpath); if (is_array($fileData)) { $this->width = $fileData[0]; $this->height = $fileData[1]; $this->whstring = $fileData[3]; $this->mimetype = $fileData['mime']; } } }
/** * initialisiert Bild-Objekt * @param bool $initDB * @return boolean */ protected function init($initDB) { if ($initDB) { $dbData = $this->dbcon->fetch($this->dbcon->select($this->table, '*', 'filename = ?', array($this->filename))); if (!$dbData) { return false; } foreach ($dbData as $key => $value) { $this->{$key} = $value; } } $ext = pathinfo($this->fullpath, PATHINFO_EXTENSION); $this->extension = $ext ? $ext : ''; $this->filesize = filesize($this->fullpath); if (parent::exists()) { $fileData = getimagesize($this->fullpath); if (is_array($fileData)) { $this->width = $fileData[0]; $this->height = $fileData[1]; $this->whstring = $fileData[3]; $this->mimetype = $fileData['mime']; } } }