2005-01-24 18:00:03 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
This file is part of the 'Science Fair In A Box' project
|
|
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
?>
|
2005-01-14 19:44:37 +00:00
|
|
|
<?
|
|
|
|
require("../common.inc.php");
|
2005-02-16 22:50:43 +00:00
|
|
|
auth_required('config');
|
2005-01-14 19:44:37 +00:00
|
|
|
send_header("Configuration - Images");
|
|
|
|
echo "<a href=\"index.php\"><< ".i18n("Back to Configuration")."</a><br />";
|
|
|
|
|
|
|
|
if($_POST['action']=="addimage")
|
|
|
|
{
|
|
|
|
if($_FILES['image']['error']==UPLOAD_ERR_OK)
|
|
|
|
{
|
|
|
|
//make sure its a JPEG
|
|
|
|
$imagesize=getimagesize($_FILES['image']['tmp_name']);
|
|
|
|
if($imagesize[2]==1 || $imagesize[2]==2 || $imagesize[2]==3) // GIF or JPG or PNG
|
|
|
|
{
|
|
|
|
echo notice(i18n("Creating sized logo files:<br /> logo-100.gif<br /> logo-200.gif<br /> logo-500.gif<br /> logo.gif"));
|
2006-12-18 20:55:30 +00:00
|
|
|
//Make the gif's
|
2005-01-14 19:44:37 +00:00
|
|
|
system("convert -sample 100 \"".$_FILES['image']['tmp_name']."\" ../data/logo-100.gif");
|
|
|
|
system("convert -sample 200 \"".$_FILES['image']['tmp_name']."\" ../data/logo-200.gif");
|
|
|
|
system("convert -sample 500 \"".$_FILES['image']['tmp_name']."\" ../data/logo-500.gif");
|
|
|
|
system("convert \"".$_FILES['image']['tmp_name']."\" ../data/logo.gif");
|
2006-12-18 20:55:30 +00:00
|
|
|
|
2007-11-15 16:58:31 +00:00
|
|
|
if(file_exists("../data/logo-100.gif") && file_exists("../data/logo-200.gif") && file_exists("../data/logo-500.gif") && file_exists("../data/logo.gif"))
|
|
|
|
echo happy(i18n("GIF Images successfully created"));
|
|
|
|
else
|
|
|
|
echo error(i18n("Error creating GIF Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used"));
|
|
|
|
|
2006-12-18 20:55:30 +00:00
|
|
|
echo notice(i18n("Creating sized logo files:<br /> logo-100.png<br /> logo-200.png<br /> logo-500.png<br /> logo.png"));
|
|
|
|
//make some PNG's as well
|
|
|
|
system("convert -sample 100 \"".$_FILES['image']['tmp_name']."\" ../data/logo-100.png");
|
|
|
|
system("convert -sample 200 \"".$_FILES['image']['tmp_name']."\" ../data/logo-200.png");
|
|
|
|
system("convert -sample 500 \"".$_FILES['image']['tmp_name']."\" ../data/logo-500.png");
|
|
|
|
system("convert \"".$_FILES['image']['tmp_name']."\" ../data/logo.png");
|
2007-11-15 16:58:31 +00:00
|
|
|
|
|
|
|
if(file_exists("../data/logo-100.png") && file_exists("../data/logo-200.png") && file_exists("../data/logo-500.png") && file_exists("../data/logo.png"))
|
|
|
|
echo happy(i18n("PNG Images successfully created"));
|
|
|
|
else
|
|
|
|
echo error(i18n("Error creating PNG Image files. Make sure 'convert' binary is in your path, and that 'system' function can be used"));
|
2005-01-14 19:44:37 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo error(i18n("Logo Image must be JPG, GIF or PNG"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
echo error(i18n("Error uploading Logo Image").": ".$_FILES['image']['error']);
|
|
|
|
}
|
|
|
|
|
2007-01-16 19:45:12 +00:00
|
|
|
if($_POST['action']=="delimage") {
|
2007-01-21 18:41:47 +00:00
|
|
|
@unlink("../data/logo.gif");
|
|
|
|
@unlink("../data/logo-100.gif");
|
|
|
|
@unlink("../data/logo-200.gif");
|
|
|
|
@unlink("../data/logo-500.gif");
|
|
|
|
@unlink("../data/logo.png");
|
|
|
|
@unlink("../data/logo-100.png");
|
|
|
|
@unlink("../data/logo-200.png");
|
|
|
|
@unlink("../data/logo-500.png");
|
|
|
|
|
2007-01-16 19:45:12 +00:00
|
|
|
echo happy(i18n("Deleted any existing logo files"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-01-14 19:44:37 +00:00
|
|
|
|
|
|
|
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">";
|
|
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"addimage\">\n";
|
2006-01-19 17:15:07 +00:00
|
|
|
echo "<h3>".i18n("Fair Logo Image")."</h3>";
|
2005-01-14 19:44:37 +00:00
|
|
|
echo "<table>";
|
|
|
|
if(file_exists("../data/logo.gif"))
|
|
|
|
{
|
2006-12-18 20:55:30 +00:00
|
|
|
echo "<tr><td colspan=\"2\">".i18n("GIF Images")."</td></tr>";
|
2005-01-14 19:44:37 +00:00
|
|
|
echo "<tr><td>";
|
|
|
|
echo "<img src=\"../data/logo-100.gif\" border=\"0\">";
|
|
|
|
echo "</td><td>";
|
2006-01-19 17:15:07 +00:00
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo.gif\">",i18n("Original size")."</a><br />";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-100.gif\">".i18n("100 Pixel width")."</a><br />";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-200.gif\">".i18n("200 Pixel width")."</a><br />";
|
2005-01-14 19:44:37 +00:00
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-500.gif\">500 Pixel width</a><br />";
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
2006-12-18 20:55:30 +00:00
|
|
|
if(file_exists("../data/logo.png"))
|
|
|
|
{
|
|
|
|
echo "<tr><td colspan=\"2\">".i18n("PNG Images")."</td></tr>";
|
|
|
|
echo "<tr><td>";
|
|
|
|
echo "<img src=\"../data/logo-100.png\" border=\"0\">";
|
|
|
|
echo "</td><td>";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo.png\">",i18n("Original size")."</a><br />";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-100.png\">".i18n("100 Pixel width")."</a><br />";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-200.png\">".i18n("200 Pixel width")."</a><br />";
|
|
|
|
echo "<a target=\"_blank\" href=\"../data/logo-500.png\">500 Pixel width</a><br />";
|
|
|
|
echo "</td></tr>";
|
|
|
|
}
|
2005-01-14 19:44:37 +00:00
|
|
|
echo "<tr><td colspan=2>";
|
|
|
|
echo "<input type=\"file\" name=\"image\">";
|
|
|
|
echo "<input type=\"submit\" value=\"".i18n("Upload Logo")."\" />\n";
|
|
|
|
echo "</td></tr>";
|
|
|
|
echo "</table>";
|
|
|
|
echo "</form>";
|
|
|
|
|
2007-01-16 19:45:12 +00:00
|
|
|
if( file_exists("../data/logo.gif") || file_exists("../data/logo.png")) {
|
|
|
|
echo "<br />";
|
|
|
|
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">";
|
|
|
|
echo "<input type=\"hidden\" name=\"action\" value=\"delimage\">\n";
|
|
|
|
echo "<input type=\"submit\" value=\"".i18n("Delete Logo")."\" />\n";
|
|
|
|
echo "</form>";
|
|
|
|
}
|
|
|
|
|
2005-01-14 19:44:37 +00:00
|
|
|
send_footer();
|
|
|
|
?>
|