Fixed some php notices

This commit is contained in:
Tobias Reich 2014-01-26 15:16:59 +01:00
parent 89a721a222
commit 540304eb26
5 changed files with 23 additions and 13 deletions

2
assets/js/min/main.js Normal file → Executable file

File diff suppressed because one or more lines are too long

4
assets/js/modules/upload.js Normal file → Executable file
View File

@ -55,7 +55,7 @@ upload = {
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
if (files[i].type!=="image/jpeg"&&files[i].type!=="image/jpg"&&files[i].type!=="image/png"&&files[i].type!=="image/gif") { if (files[i].type!=="image/jpeg"&&files[i].type!=="image/jpg"&&files[i].type!=="image/png"&&files[i].type!=="image/gif"&&files[i].type!=="image/webp") {
loadingBar.show("error", "The file format of " + files[i].name + " is not supported."); loadingBar.show("error", "The file format of " + files[i].name + " is not supported.");
return false; return false;
} else { } else {
@ -134,7 +134,7 @@ upload = {
if (link&&link.length>3) { if (link&&link.length>3) {
extension = link.split('.').pop(); extension = link.split('.').pop();
if (extension!=="jpeg"&&extension!=="jpg"&&extension!=="png"&&extension!=="gif") { if (extension!=="jpeg"&&extension!=="jpg"&&extension!=="png"&&extension!=="gif"&&extension!=="webp") {
loadingBar.show("error", "The file format of this link is not supported."); loadingBar.show("error", "The file format of this link is not supported.");
return false; return false;
} }

View File

@ -92,6 +92,7 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
break; break;
case 'setAlbumPublic': if (isset($_POST['albumID'])) case 'setAlbumPublic': if (isset($_POST['albumID']))
if (!isset($_POST['password'])) $_POST['password'] = '';
echo setAlbumPublic($_POST['albumID'], $_POST['password']); echo setAlbumPublic($_POST['albumID'], $_POST['password']);
break; break;

View File

@ -122,8 +122,9 @@ function getAlbum($albumID) {
$query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE public = 1 " . $settings['sorting']; $query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE public = 1 " . $settings['sorting'];
break; break;
case 0: $return['public'] = false; case "0": $return['public'] = false;
$query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE album = 0 " . $settings['sorting']; $query = "SELECT id, title, sysdate, public, star, album, thumbUrl FROM lychee_photos WHERE album = 0 " . $settings['sorting'];
break;
default: $result = $database->query("SELECT * FROM lychee_albums WHERE id = '$albumID';"); default: $result = $database->query("SELECT * FROM lychee_albums WHERE id = '$albumID';");
$row = $result->fetch_object(); $row = $result->fetch_object();

View File

@ -182,15 +182,19 @@ function getInfo($filename) {
$return['description'] = ''; $return['description'] = '';
// IPTC Metadata // IPTC Metadata
$iptcInfo = iptcparse($iptcArray['APP13']); if(isset($iptcArray['APP13'])) {
if (is_array($iptcInfo)) {
$iptcInfo = iptcparse($iptcArray['APP13']);
$temp = $iptcInfo['2#105'][0]; if (is_array($iptcInfo)) {
if (isset($temp)&&strlen($temp)>0) $return['title'] = $temp;
$temp = $iptcInfo['2#105'][0];
$temp = $iptcInfo['2#120'][0]; if (isset($temp)&&strlen($temp)>0) $return['title'] = $temp;
if (isset($temp)&&strlen($temp)>0) $return['description'] = $temp;
$temp = $iptcInfo['2#120'][0];
if (isset($temp)&&strlen($temp)>0) $return['description'] = $temp;
}
} }
// EXIF Metadata Fallback // EXIF Metadata Fallback
@ -270,12 +274,16 @@ function createThumb($filename, $width = 200, $height = 200) {
$startWidth = $info[0]/2 - $info[1]/2; $startWidth = $info[0]/2 - $info[1]/2;
$startHeight = 0; $startHeight = 0;
} }
// Fallback for older version
if ($info['mime']==='image/webp'&&floatval(phpversion())<5.5) return false;
// Create new image // Create new image
switch($info['mime']) { switch($info['mime']) {
case 'image/jpeg': $sourceImg = imagecreatefromjpeg($url); break; case 'image/jpeg': $sourceImg = imagecreatefromjpeg($url); break;
case 'image/png': $sourceImg = imagecreatefrompng($url); break; case 'image/png': $sourceImg = imagecreatefrompng($url); break;
case 'image/gif': $sourceImg = imagecreatefromgif($url); break; case 'image/gif': $sourceImg = imagecreatefromgif($url); break;
case 'image/webp': $sourceImg = imagecreatefromwebp($url); break;
default: return false; default: return false;
} }