Conversation
c2af8cf to
69f6e33
Compare
src/Service/ImageManager.php
Outdated
| unlink($tempPath); | ||
| } | ||
|
|
||
| return $compressed && $copied; |
There was a problem hiding this comment.
If $copied is true, then $compressed has to be true. So this && is redundant.
There was a problem hiding this comment.
no it does not. The copy operation could fail, then you would not make into the if in line 130 and $copied would be false
There was a problem hiding this comment.
Right. My argument still holds. As $compressed && $copied can be shortened to $copied.
$compressed === false -> $copied === false === ($compressed && $copied)
$compressed === true ; <copy fails> -> $copied === false === ($compressed && $copied)
$$compressed === true ; <copy sucessful> -> $copied === true === ($compressed && $copied)
- add `created_at` and `downloaded_at` timestamps to the image entity - add `local_size` and `original_size` properties to the image entity. Will be 0 per default and will stay like this for a while - explicitly pull in the `imagine` library already used via `liip/imagine-bundle` to compress images - new setting for the compression quality, it defaults to `-1` which disables it. If enabled it will compress images to stay under the max image bytes setting - add command to remove cached remote images without removing the reference, that way they can be redownloaded if needed - redownload not-cached images when opening the thread it is attached to (if it was a comment then the thread is also the relevant thing)
- fix naming of the repository in both `PostSingleController` and `EntrySingleController` - always use the highest compression for PNGs
69f6e33 to
aa37fcb
Compare
| ## A better user experience | ||
|
|
||
| Normally there is a maximum image size your users must adhere to, but if image compression is enabled, | ||
| instead of showing your user an error that the image exceeds that size, the upload goes through and the image is compressed. |
There was a problem hiding this comment.
What happens if a user uploads a PNG which is over the size limit. As it can not be further compressed, will it be rejected or be stored despite being larger than allowed?
There was a problem hiding this comment.
I think it should then still get rejected imo
There was a problem hiding this comment.
Everything above the size limit will still be rejected
| */ | ||
| public function findOldRemoteMediaPaginated(int $olderThanDays, int $limit = 10000): Pagerfanta | ||
| { | ||
| $query = $this->createQueryBuilder('i') |
There was a problem hiding this comment.
this variable seems to be unused
22fcd7a to
34d6a19
Compare
created_atanddownloaded_attimestamps to the image entitylocal_sizeandoriginal_sizeproperties to the image entity. Will be 0 per default and will stay like this for a whileimaginelibrary already used vialiip/imagine-bundleto compress images-1which disables it. If enabled it will compress images to stay under the max image bytes settingCloses #511