Make the logo admin page more friendly.

This commit is contained in:
Alexandre Rosenfeld
2011-02-21 20:54:55 +00:00
parent 7284b14e4b
commit 95b6b6c8e0
3 changed files with 24 additions and 17 deletions

View File

@@ -52,11 +52,15 @@
function showLogo($imagen){
$ext = substr($imagen, strrpos($imagen, '.') + 1); // extension
header('content-type: image/'.$ext);
readfile($imagen);
exit;
$info = @getimagesize($imagen);
$fp = fopen($imagen, "rb");
if ($info && $fp) {
header("Content-type: {$info['mime']}");
fpassthru($fp);
exit;
} else {
throw new Exception("Image format not valid");
}
}
function cpyMoreLogos($dir,$newDir){

View File

@@ -69,12 +69,7 @@
label:G_STRINGS.ID_APPLY_LOGO,
action:function(){
ajax_function('replacementLogo','replacementLogo','NAMELOGO='+encodeURIComponent(nameLogo),'GET') ;
//parent.window.location.href = 'main_init';
if(_BROWSER.name == 'msie' )
parent.parent.window.location.href = 'main?s=LOGO';
else
parent.window.location.href = 'main_init';
history.go(0);
parent.parent.window.location = 'main?s=LOGO';
}});
}
@@ -89,7 +84,7 @@
label:G_STRINGS.ID_REMOVE_LOGO,
action:function(){
ajax_function('logo_Delete','','NAMELOGO='+nameLogo,'GET') ;
history.go(0);
window.location = 'uplogo';
}
});
return false;
@@ -102,7 +97,6 @@
*/
var restoreLogo = function (optfiledb, usrUid){
ajax_function('replacementLogo','restoreLogo','OPTFILEDB='+optfiledb+'&USRUID='+usrUid,'GET') ;
//parent.window.location.href = 'setup';
parent.window.location.href = 'main_init';
window.location = 'uplogo';
}
</script>

View File

@@ -101,6 +101,7 @@ try {
</a></td></tr>";
$template->assign ('SET_LOGO_PM' ,$restoreLogo);
}*/
if (sizeof($_POST)>0) {
//G::SendTemporalMessage('ID_CHANGES_SAVED', 'info', 'labels');
$formf = $_FILES['form'];
@@ -111,11 +112,19 @@ try {
$aMessage1 = array();
$fileName = trim(str_replace(' ','_', $namefile));
G::uploadFile( $tpnfile, $dir . '/', 'tmp'.$fileName );
G::resizeImage($dir . '/tmp' . $fileName, 200, 80, $dir . '/' .$fileName);
$error = false;
try {
G::resizeImage($dir . '/tmp' . $fileName, 200, 80, $dir . '/' .$fileName);
} catch (Exception $e) {
$error = $e->getMessage();
}
unlink ($dir . '/tmp' . $fileName);
header('location: uplogo.php');
if ($error === false)
header('location: uplogo.php');
else
G::SendTemporalMessage($error, 'error', 'string');
}
$content = $template->getOutputContent();
$content = $template->getOutputContent();
print $content;
}
catch (Exception $e) {