Fixed some php notices

pull/57/head
Tobias Reich 10 years ago
parent 89a721a222
commit 540304eb26

File diff suppressed because one or more lines are too long

@ -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;
} }

@ -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;

@ -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();

@ -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;
} }

Loading…
Cancel
Save