/** * Sets icon for object. * * @internal change person icons to 50x50 done by wofli_fhsp and buddafly * @param object $file pathname of file * @return boolean True if the function succeeded, else false */ function setIcon($file, $ispersonicon = false) { // change from wolfi_fhstp and buddhafly (change person icons to 50x50) global $config; $tmpfile = $config['tmpDir'] . '/' . time() . ".png"; if ($ispersonicon) { $succ = $this->prepareIcon($file, $tmpfile, 50, 50); } else { $succ = $this->prepareIcon($file, $tmpfile, $config['iconWidth'], $config['iconHeight']); } //----------------------------------------------------------------------------------------- if (!$succ) { addError("Could not resize image"); //return false; } else { if ($fp = fopen($tmpfile, 'rb')) { $data = fread($fp, filesize($tmpfile)); fclose($fp); // save into DB sotf_Blob::saveBlob($this->id, "icon", $data); // save into file system $iconFile = $this->getMetaDir() . '/icon.png'; sotf_Utils::save($iconFile, $data); } else { addError("could not open icon file!"); } } if (is_file($tmpfile)) { debug("remove tmpfile", $tmpfile); unlink($tmpfile); } sotf_Blob::uncacheIcon($this->id); return true; }