forked from science-ation/science-ation
55 lines
2.0 KiB
PHP
55 lines
2.0 KiB
PHP
|
<?
|
||
|
require("../common.inc.php");
|
||
|
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"));
|
||
|
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");
|
||
|
echo happy(i18n("Logo Image successfully uploaded"));
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
echo error(i18n("Logo Image must be JPG, GIF or PNG"));
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
echo error(i18n("Error uploading Logo Image").": ".$_FILES['image']['error']);
|
||
|
}
|
||
|
|
||
|
|
||
|
echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"images.php\">";
|
||
|
echo "<input type=\"hidden\" name=\"action\" value=\"addimage\">\n";
|
||
|
echo "<h3>Fair Logo Image</h3>";
|
||
|
echo "<table>";
|
||
|
if(file_exists("../data/logo.gif"))
|
||
|
{
|
||
|
echo "<tr><td>";
|
||
|
echo "<img src=\"../data/logo-100.gif\" border=\"0\">";
|
||
|
echo "</td><td>";
|
||
|
echo "<a target=\"_blank\" href=\"../data/logo.gif\">Original size</a><br />";
|
||
|
echo "<a target=\"_blank\" href=\"../data/logo-100.gif\">100 Pixel width</a><br />";
|
||
|
echo "<a target=\"_blank\" href=\"../data/logo-200.gif\">200 Pixel width</a><br />";
|
||
|
echo "<a target=\"_blank\" href=\"../data/logo-500.gif\">500 Pixel width</a><br />";
|
||
|
echo "</td></tr>";
|
||
|
}
|
||
|
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>";
|
||
|
|
||
|
send_footer();
|
||
|
?>
|