mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Add minimum artwork dimensions
This commit is contained in:
parent
3d85a6d936
commit
5b6a334dd0
4 changed files with 21 additions and 2 deletions
|
@ -365,7 +365,13 @@ class Artwork extends PropertiesBase{
|
|||
}
|
||||
|
||||
if(!is_uploaded_file($uploadedFile['tmp_name'])){
|
||||
throw new Exceptions\InvalidImageUploadException();
|
||||
$error->Add(new Exceptions\InvalidImageUploadException());
|
||||
}
|
||||
|
||||
// Check for minimum dimensions
|
||||
list($imageWidth, $imageHeight) = getimagesize($uploadedFile['tmp_name']);
|
||||
if(!$imageWidth || !$imageHeight || $imageWidth < COVER_ARTWORK_IMAGE_MINIMUM_WIDTH || $imageHeight < COVER_ARTWORK_IMAGE_MINIMUM_HEIGHT){
|
||||
$error->Add(new Exceptions\ArtworkImageDimensionsTooSmallException());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ const COVER_ARTWORK_STATUS_IN_USE = 'in_use';
|
|||
const COVER_ARTWORK_STATUS_UNVERIFIED = 'unverified';
|
||||
const COVER_ARTWORK_MAX_STRING_LENGTH = 191;
|
||||
const COVER_ARTWORK_MAX_TAGS = 100;
|
||||
const COVER_ARTWORK_IMAGE_MINIMUM_WIDTH = 300;
|
||||
const COVER_ARTWORK_IMAGE_MINIMUM_HEIGHT = 300;
|
||||
const SORT_COVER_ARTWORK_CREATED_NEWEST = 'created-newest';
|
||||
const SORT_COVER_ARTIST_ALPHA = 'artist-alpha';
|
||||
const SORT_COVER_ARTWORK_COMPLETED_NEWEST = 'completed-newest';
|
||||
|
|
11
lib/Exceptions/ArtworkImageDimensionsTooSmallException.php
Normal file
11
lib/Exceptions/ArtworkImageDimensionsTooSmallException.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class ArtworkImageDimensionsTooSmallException extends AppException{
|
||||
protected $message;
|
||||
|
||||
// This has to be initialized in a constructor because we use the number_format() function.
|
||||
public function __construct(){
|
||||
$this->message = 'Image dimensions are too small. The minimum image size is ' . number_format(COVER_ARTWORK_IMAGE_MINIMUM_WIDTH) . ' × ' . number_format(COVER_ARTWORK_IMAGE_MINIMUM_HEIGHT) . '.';
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ catch(Exceptions\InvalidPermissionsException){
|
|||
</label>
|
||||
<label>
|
||||
<span>High-resolution image</span>
|
||||
<span>jpg, bmp, png, and tiff are accepted; 32MB max.</span>
|
||||
<span>jpg, bmp, png, and tiff are accepted; <?= number_format(COVER_ARTWORK_IMAGE_MINIMUM_WIDTH) ?> × <?= number_format(COVER_ARTWORK_IMAGE_MINIMUM_HEIGHT) ?> minimum; 32MB max.</span>
|
||||
<input
|
||||
type="file"
|
||||
name="artwork-image"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue