Page 1 of 1

failed to resample image

Posted: Thu Nov 02, 2023 11:49 am
by CasN
When updating the database, i get the message:
image_2023-11-02_114827528.png
image_2023-11-02_114827528.png (12.44 KiB) Viewed 38138 times
What can I do to overcome this error?

Re: failed to resample image

Posted: Thu Nov 02, 2023 7:14 pm
by wbartels
Here is the code that created the error message:

Code: Select all

$extension = strtolower(substr(strrchr($image, '.'), 1));

if		($extension == 'jpg')	$src_image = @imageCreateFromJpeg($image)	or message(__FILE__, __LINE__, 'error', '[b]Failed to resample image:[/b][br]' . $image);
elseif	($extension == 'png')	$src_image = @imageCreateFromPng($image)	or message(__FILE__, __LINE__, 'error', '[b]Failed to resample image:[/b][br]' . $image);
else																		message(__FILE__, __LINE__, 'error', '[b]Failed to resample image:[/b][br]Unsupported extension.');
I think that one of the two reason created the error:
  • The file with the jpg extension isn't a jpg file
  • The jpg file is corrupted
A simple solution would be to replace the image file.
If this doesn't help send me the cover.jpg file by private message for examination.

Success CasN!

Re: failed to resample image

Posted: Fri Nov 03, 2023 10:56 am
by CasN
Hi Waldo,
that was the issue, it appeared to be a png-file. So a question of renaming and on to the next.
Thanks so far (bedankt!),
Cas

Re: failed to resample image

Posted: Sat Nov 04, 2023 6:17 pm
by wbartels
CasN wrote: Fri Nov 03, 2023 10:56 am Hi Waldo,
that was the issue, it appeared to be a png-file. So a question of renaming and on to the next.
Thanks so far (bedankt!),
Cas
Your welcome, graag gedaan ;-)
I will add image file validation on the next release!

Re: failed to resample image

Posted: Tue Nov 07, 2023 6:31 pm
by wbartels
This update creates a more meaningfull error message in the include/library_message.inc.php script around line 100

Code: Select all

if		($extension == 'jpg')	$src_image = @imageCreateFromJpeg($image)	or message(__FILE__, __LINE__, 'error', '[b]Failed to resample[/b][br]This is not a vallid JPG image:[br]' . $image);
elseif	($extension == 'png')	$src_image = @imageCreateFromPng($image)	or message(__FILE__, __LINE__, 'error', '[b]Failed to resample[/b][br]This is not a vallid PNG image:[br]' . $image);
else																		message(__FILE__, __LINE__, 'error', '[b]Failed to resample[/b][br]Unsupported or corrupted image:[br]' . $image);

Re: failed to resample image

Posted: Wed Nov 08, 2023 11:02 am
by CasN
I have replaced the existing code with these lines (hope I do not need it anymore :D ).

Re: failed to resample image

Posted: Sat Nov 11, 2023 4:28 pm
by CasN
Also noticed that in case a cover image in not present, Netjukebox tries to obtain from the MP3 itself. Under windows the file extracted is not usable hence the update process stops. In my view the process should continue and the album should be added to the onces that need additional attention.

Re: failed to resample image

Posted: Sat Nov 11, 2023 10:17 pm
by wbartels
CasN wrote: Sat Nov 11, 2023 4:28 pm Also noticed that in case a cover image in not present, Netjukebox tries to obtain from the MP3 itself. Under windows the file extracted is not usable hence the update process stops. In my view the process should continue and the album should be added to the onces that need additional attention.
Thanks, I will look in this later.
Maybe you are willing to help me because I haven't a Windows (virtual) computer.

Re: failed to resample image

Posted: Sun Nov 12, 2023 3:23 pm
by wbartels
CasN wrote: Sat Nov 11, 2023 4:28 pm Also noticed that in case a cover image in not present, Netjukebox tries to obtain from the MP3 itself. Under windows the file extracted is not usable hence the update process stops. In my view the process should continue and the album should be added to the onces that need additional attention.
It could be that only on Windows the helper apps from getID3() are needed.
You can download the complete getID3() v1.9.16 (with helper apps) from:
https://github.com/JamesHeinrich/getID3 ... 1.9.16.zip
Would you be so kind to test it with the 1.9.16 package?
If it works you can of course try the latest 1.9.xx package.

On a live environment I should always delete the demo directory.
It is also save to delete the getid3/extension.cache.xxx.php files.

Re: failed to resample image

Posted: Sun Nov 12, 2023 3:31 pm
by wbartels
CasN wrote: Sat Nov 11, 2023 4:28 pm Also noticed that in case a cover image in not present, Netjukebox tries to obtain from the MP3 itself. Under windows the file extracted is not usable hence the update process stops. In my view the process should continue and the album should be added to the onces that need additional attention.
It is possible to (temporary) disable the image extraction in the config.inc.php file:

Code: Select all

$cfg['image_read_embedded']            = false;

Re: failed to resample image

Posted: Mon Nov 13, 2023 1:54 pm
by CasN
I tried first adding the Windows helper apps, no luck. Next I downloaded the latest GetID3 and moved the downloaded helper apps to the bin directory, no luck. Next I switched of reading the embedded and this clearly worked.
I also have a folder image which I can use as the front cover so i am all set.

Windows is a system I use for day to day work (and trying out new software as well), my websites are under Ubuntu (where it is working without issues).

Re: failed to resample image

Posted: Mon Nov 13, 2023 5:21 pm
by wbartels
CasN wrote: Mon Nov 13, 2023 1:54 pm I tried first adding the Windows helper apps, no luck. Next I downloaded the latest GetID3 and moved the downloaded helper apps to the bin directory, no luck. Next I switched of reading the embedded and this clearly worked.
I also have a folder image which I can use as the front cover so i am all set.

Windows is a system I use for day to day work (and trying out new software as well), my websites are under Ubuntu (where it is working without issues).
Thanks for the help and infos!
getID3() has its own directory for helperapps (without a bin directory): netjukebox/lib/getid3/helperapps/
I know it is confusing with also a netjukebox helper app directory, sorry ;-)
Could you try it again and place the getID3() helper apps in netjukebox/lib/getid3/helperapps/

Thanks!

Re: failed to resample image

Posted: Tue Nov 14, 2023 9:18 am
by CasN
Ok, tried that also but still get the same error message. I have attaached the (extracted) jpg file that is causing the issue

Re: failed to resample image

Posted: Thu Nov 16, 2023 12:43 am
by wbartels
Now I can reproduce the error message on Windows.
The same flac file with embedded jpg image extract correctly on Ubuntu.
These are the same findings you described.

If I have time again I will look into it.
For the meantime Windows users can disable reading embedded images:

Code: Select all

$cfg['image_read_embedded']            = false;
PS
It dit took me a while to install Windows 11 ARM64 on a Mac mini M2.
With trail and error I discovered UTM and that did the trick.
https://docs.getutm.app/guides/windows/
The installation is much smoother than in the above guide.

Moved

Posted: Thu Nov 16, 2023 1:26 am
by wbartels
I will lock this topic because the first section has been a fix.
And the second section is moved to Windows related