Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagejpeg error #258

Open
mikeatcityuni opened this issue Mar 8, 2023 · 0 comments
Open

imagejpeg error #258

mikeatcityuni opened this issue Mar 8, 2023 · 0 comments

Comments

@mikeatcityuni
Copy link

Hi, we're getting an error with snap when we add a course image in the course settings. Actually we don't even use snap but the error is still reported! We've got version 4.0.5 (2023012400)

debug message:

line 190 of /theme/snap/classes/image.php: ArgumentCountError thrown
line 190 of /theme/snap/classes/image.php: call to imagejpeg()
line 1296 of /theme/snap/classes/local.php: call to theme_snap\image::resize()
line 1569 of /theme/snap/classes/local.php: call to theme_snap\local::set_course_card_image()
line 58 of /theme/snap/classes/event_handlers.php: call to theme_snap\local::process_coverimage()
line ? of unknownfile: call to theme_snap\event_handlers::course_updated()
line 155 of /lib/classes/event/manager.php: call to call_user_func()
line 75 of /lib/classes/event/manager.php: call to core\event\manager::process_buffers()
line 834 of /lib/classes/event/base.php: call to core\event\manager::dispatch()
line 2472 of /course/lib.php: call to core\event\base->trigger()
line 191 of /course/edit.php: call to update_course()

https://www.php.net/manual/en/function.imagejpeg.php

imagejpeg(GdImage $image, resource|string|null $file = null, int $quality = -1): bool
imagejpeg() creates a JPEG file from the given image.

so it should have 3 arguments but Snap gives it four, when a jpeg is used:

moodle-theme_snap/classes/image.php
line: 189-192

\ob_start();
if (!$imagefnc($newimage, null, $quality, $filters)) {
return false;
}

if png it should be fine as that does take 4 arguments, sure enough, adding a png results in no error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant