Exemplo n.º 1
0
                EfrontConfiguration::setValue('site_logo', $logoFile['id']);
            } catch (EfrontFileException $e) {
                if ($e->getCode() != UPLOAD_ERR_NO_FILE) {
                    throw $e;
                }
                //Don't halt if no file was uploaded (errcode = 4). Otherwise, throw the exception
            }
            if (empty($logoFile)) {
                $logoFile = new EfrontFile(EfrontSystem::setLogoFile($currentTheme));
            }
            // Normalize avatar picture to the dimensions set in the System Configuration menu. NOTE: the picture will be modified to match existing settings. Future higher settings will be disregarded, while lower ones might affect the quality of the displayed image
            if ($values["normalize_dimensions"] == 1) {
                eF_normalizeImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $values["logo_max_width"], $values["logo_max_height"]);
            } else {
                list($width, $height) = getimagesize(G_LOGOPATH . $logoFile['name']);
                eF_createImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $width, $height, $values["logo_max_width"], $values["logo_max_height"]);
            }
            EfrontConfiguration::setValue('logo_timestamp', time());
            // to avoid browser caching when changing logo dimensions
            EfrontCache::getInstance()->deleteCache('logo');
            eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=logo&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
        } catch (Exception $e) {
            handleNormalFlowExceptions($e);
        }
    }
}
$smarty->assign("T_APPEARANCE_LOGO_FORM", $appearanceLogoForm->toArray());
$appearanceFaviconForm = new Html_QuickForm("appearance_favicon_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=favicon", "", null, true);
$appearanceFaviconForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$appearanceFaviconForm->addElement('file', 'favicon', _FILENAME);
$appearanceFaviconForm->addElement("static", "", _EACHFILESIZEMUSTBESMALLERTHAN . ' <b>' . FileSystemTree::getUploadMaxSize() . '</b> ' . _KB);
Exemplo n.º 2
0
function eF_normalizeImage($filename, $extension, $maxNewWidth, $maxNewHeight)
{
    if (!extension_loaded('gd') && !extension_loaded('gd2')) {
        return false;
    }
    // Get current dimensions
    list($width, $height) = getimagesize($filename);
    // Get normalized dimensions
    list($newwidth, $newheight) = eF_getNormalizedDims($filename, $maxNewWidth, $maxNewHeight);
    return eF_createImage($filename, $extension, $width, $height, $newwidth, $newheight);
}