Commit Graph

39 Commits (feat/database/query-result-fetch-associative-fetch-num)

Author SHA1 Message Date
Git'Fellow 9d70fd3e64
Silent imagecreatefromstring() errors
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-06-30 21:58:44 +07:00
Marcel Klehr 4a2accaa27 fix OC_Image: Prevent E_WARNING from getimagesize*
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-03-16 11:10:36 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Simon L bfb3b2af9f increase preview_max_memory and make it easier to debug
Signed-off-by: Simon L <szaimen@e.mail.de>
2022-12-22 09:52:46 +07:00
J0WI 110ea0df46 Allow empty mimeType
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-04 14:51:33 +07:00
J0WI 1dd3afefcd Add type hints
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-04 14:51:32 +07:00
J0WI 53994f600d Fix redundant condition
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-04 14:47:43 +07:00
J0WI 40166ddc0a Remove obsolete GD function overwrites
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2022-12-04 14:47:43 +07:00
John Molakvoæ d27a39271e
getAppValue expects string
Co-authored-by: Pytal <24800714+Pytal@users.noreply.github.com>
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
2022-11-17 08:03:05 +07:00
Git'Fellow c7e2787300
Default Jpeg quality to 80
See https://sirv.com/help/articles/jpeg-quality-comparison/
Almost 50% of file size (compared to 90) and no visual differences.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2022-11-16 10:59:50 +07:00
Varun Patil 48917e718e Interlace all output JPEG
Progressive images are both smaller and faster to load.

Signed-off-by: Varun Patil <radialapps@gmail.com>
2022-10-25 09:40:20 +07:00
Git'Fellow 8d876358dd
Move Gd failed operations to debug level
Instead of error
2022-05-25 18:26:42 +07:00
Joachim Bauch d3d65e5c88
Prevent loading images that would require too much memory.
For most image formats, the header specifies the width/height.
PHP allocates an image object from that size, even if the actual
image data is much smaller. This image object size is not limited
by the limit configured in PHP.

The memory limit can be configured through "config.php" setting
"preview_max_memory" and defaults to 128 MBytes which should be
enough for most images without filling up all memory.

Signed-off-by: Joachim Bauch <bauch@struktur.de>
2022-01-11 11:44:38 +07:00
Côme Chilliet 8504f0a59e
Avoid assignment in if clause
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:26:27 +07:00
Côme Chilliet ab3a1d5706
Fix typing problems in OC_Image
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:26:26 +07:00
Côme Chilliet d537226368
Avoid calling image* methods on boolean
This avoids fatal errors on PHP>=8, and warnings on older versions.
Log should also be clearer.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-12-06 14:26:09 +07:00
szaimen 3ac316b77f fix imagecreatetruecolor() error
Signed-off-by: szaimen <szaimen@e.mail.de>
2021-11-10 15:50:15 +07:00
Côme Chilliet 3631789651
Fix resource usages in OC_Image
This makes sure using resource or GdImage (PHP>=8) behaves the same.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-10-28 17:48:43 +07:00
Christoph Wurst 006aac9a0c
Merge pull request #28473 from nextcloud/fix-file-get-contents
Fix path of `file_get_contents`
2021-08-25 09:28:52 +07:00
Daniel Kesselberg 60a7f5c53e
Remove unused method
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-08-18 22:10:40 +07:00
acsfer 280dd851b3
Avoid usage of Nextcloud API, use PHP function 2021-08-18 15:21:05 +07:00
Simon Spannagel 58f55975e0 Fix #20913: Check image resource before attempting to preserve alpha
Signed-off-by: Simon Spannagel <simonspa@kth.se>
2021-08-18 07:36:11 +07:00
acsfer a3c69b8310
Fix path of `file_get_contents`
Try to fix #28370  and #27441 

Avoid pre-pends the `$path` to the user's own storage.
2021-08-17 13:03:45 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Roeland Jago Douma 6d4afca7ac Add support for webp
Including handling in OC_Image
But also a preview provider

Of course only works if your php actually supports webp

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-01-19 20:17:10 +07:00
Christoph Wurst 9ce3ea3368
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-30 14:07:05 +07:00
Roeland Jago Douma adc4f1a811
Merge pull request #22916 from J0WI/unifiy-links-to-php.net
Unify links to php.net
2020-12-22 09:53:31 +07:00
Roeland Jago Douma 7f61535a1a
GD images
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-12-07 15:44:04 +07:00
J0WI 68ce17e59b Unify links to php.net
Update all links to https://www.php.net/

Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2020-09-17 17:40:04 +07:00
Morris Jobke 46525f8639
Change 0 to null to properly encode image to BMP if the first pixel is black
Ref #22288

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-10 12:08:01 +07:00
Morris Jobke 27e7332a9c
Cast float/char to int to avoid invalid scalar argument warning
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-18 16:51:59 +07:00
Roeland Jago Douma 0c35aaba29
Fix OC_Image new resize functions
Else the wrong mimetype might be set. Resulting in continious
regeneration of previews when browsing.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-05-02 21:57:34 +07:00
Christoph Wurst a7c8d26d31
Add visibility to all properties and move static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 16:48:31 +07:00
Christoph Wurst 1762a409f9
Merge pull request #20422 from nextcloud/techdebt/format-control-structs-classes-methods
Format control structures, classes, methods and function
2020-04-10 16:38:23 +07:00
Roeland Jago Douma eba3726e1e
Merge pull request #19495 from nextcloud/preview-generate-batch
optimize batch generation of previews
2020-04-10 15:57:06 +07:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00
Robin Appelman 7d386872e5
optimize batch generation of previews
by allowing the generation of multiple previews at once we save on having to find, open and decode the max-preview for every preview of the same file

the main use case for this is the preview generator app (pr for that comming next)

in my local testing this saves about 25% of time when using the preview generator app

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-09 12:50:59 +07:00
Christoph Wurst 1e086064f5
Move legacy classes from PSR0 to PSR4
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-07 08:48:00 +07:00