forked from Public/pics
		
	Asset/Thumbnail: replace 'NULL' placeholder strings with actual null values
This commit is contained in:
		
							parent
							
								
									3dfda45681
								
							
						
					
					
						commit
						26d8063c45
					
				@ -32,7 +32,7 @@ class Asset
 | 
			
		||||
				$this->$attribute = $value;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (isset($data['date_captured']) && $data['date_captured'] !== 'NULL' && !is_object($data['date_captured']))
 | 
			
		||||
		if (isset($data['date_captured']) && $data['date_captured'] !== null && !is_object($data['date_captured']))
 | 
			
		||||
			$this->date_captured = new DateTime($data['date_captured']);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -273,9 +273,9 @@ class Asset
 | 
			
		||||
				'title' => $title,
 | 
			
		||||
				'slug' => $slug,
 | 
			
		||||
				'mimetype' => $mimetype,
 | 
			
		||||
				'image_width' => isset($image_width) ? $image_width : 'NULL',
 | 
			
		||||
				'image_height' => isset($image_height) ? $image_height : 'NULL',
 | 
			
		||||
				'date_captured' => isset($date_captured) ? $date_captured : 'NULL',
 | 
			
		||||
				'image_width' => isset($image_width) ? $image_width : null,
 | 
			
		||||
				'image_height' => isset($image_height) ? $image_height : null,
 | 
			
		||||
				'date_captured' => isset($date_captured) ? $date_captured : null,
 | 
			
		||||
				'priority' => isset($priority) ? (int) $priority : 0,
 | 
			
		||||
			]);
 | 
			
		||||
 | 
			
		||||
@ -504,9 +504,9 @@ class Asset
 | 
			
		||||
			[
 | 
			
		||||
				'id_asset' => $this->id_asset,
 | 
			
		||||
				'mimetype' => $this->mimetype,
 | 
			
		||||
				'image_width' => isset($this->image_width) ? $this->image_width : 'NULL',
 | 
			
		||||
				'image_height' => isset($this->image_height) ? $this->image_height : 'NULL',
 | 
			
		||||
				'date_captured' => isset($this->date_captured) ? $this->date_captured : 'NULL',
 | 
			
		||||
				'image_width' => isset($this->image_width) ? $this->image_width : null,
 | 
			
		||||
				'image_height' => isset($this->image_height) ? $this->image_height : null,
 | 
			
		||||
				'date_captured' => isset($this->date_captured) ? $this->date_captured : null,
 | 
			
		||||
				'priority' => $this->priority,
 | 
			
		||||
			]);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -335,7 +335,7 @@ class Thumbnail
 | 
			
		||||
		if ($success)
 | 
			
		||||
		{
 | 
			
		||||
			$thumb_selector = $this->width . 'x' . $this->height . $this->filename_suffix;
 | 
			
		||||
			$this->thumbnails[$thumb_selector] = $filename !== 'NULL' ? $filename : null;
 | 
			
		||||
			$this->thumbnails[$thumb_selector] = $filename ?? null;
 | 
			
		||||
 | 
			
		||||
			// For consistency, write new thumbnail filename to parent Image object.
 | 
			
		||||
			// TODO: there could still be an inconsistency if multiple objects exists for the same image asset.
 | 
			
		||||
@ -349,7 +349,7 @@ class Thumbnail
 | 
			
		||||
 | 
			
		||||
	private function markAsQueued()
 | 
			
		||||
	{
 | 
			
		||||
		$this->updateDb('NULL');
 | 
			
		||||
		$this->updateDb(null);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private function markAsGenerated($filename)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user