Browse Source

Fixed some php notices

Tobias Reich 10 years ago
parent
commit
540304eb26
5 changed files with 22 additions and 12 deletions
  1. 0 0
      assets/js/min/main.js
  2. 2 2
      assets/js/modules/upload.js
  3. 1 0
      php/api.php
  4. 2 1
      php/modules/album.php
  5. 17 9
      php/modules/upload.php

File diff suppressed because it is too large
+ 0 - 0
assets/js/min/main.js


+ 2 - 2
assets/js/modules/upload.js

@@ -55,7 +55,7 @@ upload = {
 
 			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.");
 					return false;
 				} else {
@@ -134,7 +134,7 @@ upload = {
 					if (link&&link.length>3) {
 
 						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.");
 							return false;
 						}

+ 1 - 0
php/api.php

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

+ 2 - 1
php/modules/album.php

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

+ 17 - 9
php/modules/upload.php

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

Some files were not shown because too many files changed in this diff