Bug 13224 - Add mw (max width) param to image proxy
: Add mw (max width) param to image proxy
Status: CLOSED FIXED
Product: MySqueezebox.com
Classification: Unclassified
Component: API
: MySB
: PC Other
: P1 normal (vote)
: INXS
Assigned To: Andy Grundman
:
Depends on:
Blocks: 13225
  Show dependency treegraph
 
Reported: 2009-08-03 18:17 UTC by Andy Grundman
Modified: 2009-10-05 16:44 UTC (History)
4 users (show)

See Also:
Category: Feature


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Grundman 2009-08-03 18:17:07 UTC
If only height specified, and resized width exceeds mw, reduce height.
Comment 1 Adrian Smith 2009-08-04 01:02:09 UTC
I think the best solution would be to define both the width and height to mean maximum and always resize to the largest size which fits within this whilst keeping the image's aspect ratio.

In SC I can modify the _o_ resizing to do this (it currently ignores the width totally).
Comment 2 Andy Grundman 2009-08-04 04:36:33 UTC
I'm trying to think of a reason this wouldn't work, but it sounds OK.  I will check in my updated Slim::Utils::ImageResizer so you can take a look at this if you want.
Comment 3 Andy Grundman 2009-08-04 17:57:41 UTC
I put in a few fixes and max mode appears to be working properly now.  I am going to spend a little bit on a test suite for this also.
Comment 4 Andy Grundman 2009-08-05 20:00:41 UTC
Needs a bit more work.
Comment 5 Andy Grundman 2009-08-05 20:03:35 UTC
Notes from an email conversation with Triode:

Me:

So I think max mode needs to work a bit differently.  I think it needs to create a dest image that matches the requested width/height values, and center the original image inside of that with padding.  That's the way mode=pad works now (at least in ImageResizer).  Without that, tall/wide images will be shown at the top or left of the screen, instead of in the center.  In fact I wonder if max could just take the place of pad with this change?  So if you specify a width/height it will just do the right thing automatically.

Do you know what any of the other weird resize modes are or were ever used for?  I can't think of any reason you'd want to do some of those things (crop/squash/etc).  Maybe we could remove them to simplify the code a bit.

--

Triode:

Yes I came to the same conclusion over night too..

SP will try and resize the image again if the response is not the size it wanted and also doesn't position the image in the center of the icon area (I think it should!)

But if we resize like this onto a transparent canvas which is always the correct size and put our resized image in the middle then yes it should work and I agree this should probably replace pad!

I don't know about the resize modes - kdf is probably the person to ask, but I agree squashing and cropping seem the wrong thing to do.  My non square artwork appears squashed on the web page for instance.
Comment 6 Andy Grundman 2009-08-06 05:49:48 UTC
 == Automatic comment from SVN commit #28081 to Repository: slim ==
https://svn.slimdevices.com/slim?view=revision&revision=28081

Fixed Bug 13224 - simplify max mode, make it the default for everything, use it for pad mode.  Also added some more tests


 == Modified 2 files total ==
7.4/trunk/server/Slim/Utils/ImageResizer.pm
7.4/trunk/tests/t/05resizer.t

 == Added 2 files total ==
7.4/trunk/tests/data/images/ref/tall-cover-13x100.jpg
7.4/trunk/tests/data/images/ref/wide-cover-100x12.jpg
Comment 7 Andy Grundman 2009-08-06 16:51:12 UTC
 == Automatic comment from SVN commit #28087 to Repository: slim ==
https://svn.slimdevices.com/slim?view=revision&revision=28087

 r57579@macbookpro (orig r28080):  michael | 2009-08-06 02:38:06 -0400
 Bug: n/a
 Description: don't display download URL in web UI, unless we got an update message from SN including that URL. Don't check for downloads unless auto download is enabled.
 r57580@macbookpro (orig r28081):  andy | 2009-08-06 08:49:46 -0400
 Fixed Bug 13224 - simplify max mode, make it the default for everything, use it for pad mode.  Also added some more tests
 r57583@macbookpro (orig r28082):  andy | 2009-08-06 09:46:00 -0400
 Refactor S::W::Graphics to use ImageResizer
 r57596@macbookpro (orig r28083):  mwise | 2009-08-06 11:02:59 -0400
 Bug 13265: Should solve the shutdown issue.
 r57597@macbookpro (orig r28084):  mwise | 2009-08-06 11:45:22 -0400
 Bug 12962: Additional space at the end of the line caused the readynas init script to break.
 r57598@macbookpro (orig r28085):  andy | 2009-08-06 19:08:08 -0400
 Audio::Scan 0.28
 
 0.28    2009-08-06 19:00:00
         - Bug 13198, Changed the method for determining FLAC bitrate.
 
 0.27    2009-07-26 23:00:00
         - Added support for Musepack SV8 files.
         - Refactored Musepack code to use buffer API, fixes
           crashes on big-endian platforms.
         - Added support for reading Musepack track gain and album gain.
 r57599@macbookpro (orig r28086):  andy | 2009-08-06 19:41:16 -0400
 Fixed Bug 13252 - downgrade DBD::mysql to 3.0002 to fix crasher



 == Modified 27 files total ==
7.4/private-branches/baby-cat/
7.4/private-branches/baby-cat/platforms/debian/squeezebox.init
7.4/private-branches/baby-cat/platforms/readynas/rules
7.4/private-branches/baby-cat/platforms/readynas/squeezebox.init
7.4/private-branches/baby-cat/server/CPAN/Audio/Scan.pm
7.4/private-branches/baby-cat/server/CPAN/DBD/mysql/GetInfo.pm
7.4/private-branches/baby-cat/server/CPAN/DBD/mysql.pm
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/Audio/Scan/Scan.dll
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/mysql.dll
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/sparc-linux/auto/Audio/Scan/Scan.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/baby-cat/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/baby-cat/server/Slim/Utils/ImageResizer.pm
7.4/private-branches/baby-cat/server/Slim/Utils/Update.pm
7.4/private-branches/baby-cat/server/Slim/Web/Graphics.pm
7.4/private-branches/baby-cat/server/modules.conf
7.4/private-branches/baby-cat/tests/t/05resizer.t

 == Added 2 files total ==
7.4/private-branches/baby-cat/tests/data/images/ref/tall-cover-13x100.jpg
7.4/private-branches/baby-cat/tests/data/images/ref/wide-cover-100x12.jpg

 == Removed 2 files total ==
7.4/private-branches/baby-cat/platforms/readynas/CPAN/DBD/
7.4/private-branches/baby-cat/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/libmysql.dll
Comment 8 Andy Grundman 2009-08-06 16:58:38 UTC
 == Automatic comment from SVN commit #28088 to Repository: slim ==
https://svn.slimdevices.com/slim?view=revision&revision=28088

 r57579@macbookpro (orig r28080):  michael | 2009-08-06 02:38:06 -0400
 Bug: n/a
 Description: don't display download URL in web UI, unless we got an update message from SN including that URL. Don't check for downloads unless auto download is enabled.
 r57580@macbookpro (orig r28081):  andy | 2009-08-06 08:49:46 -0400
 Fixed Bug 13224 - simplify max mode, make it the default for everything, use it for pad mode.  Also added some more tests
 r57583@macbookpro (orig r28082):  andy | 2009-08-06 09:46:00 -0400
 Refactor S::W::Graphics to use ImageResizer
 r57596@macbookpro (orig r28083):  mwise | 2009-08-06 11:02:59 -0400
 Bug 13265: Should solve the shutdown issue.
 r57597@macbookpro (orig r28084):  mwise | 2009-08-06 11:45:22 -0400
 Bug 12962: Additional space at the end of the line caused the readynas init script to break.
 r57598@macbookpro (orig r28085):  andy | 2009-08-06 19:08:08 -0400
 Audio::Scan 0.28
 
 0.28    2009-08-06 19:00:00
         - Bug 13198, Changed the method for determining FLAC bitrate.
 
 0.27    2009-07-26 23:00:00
         - Added support for Musepack SV8 files.
         - Refactored Musepack code to use buffer API, fixes
           crashes on big-endian platforms.
         - Added support for reading Musepack track gain and album gain.
 r57599@macbookpro (orig r28086):  andy | 2009-08-06 19:41:16 -0400
 Fixed Bug 13252 - downgrade DBD::mysql to 3.0002 to fix crasher



 == Modified 27 files total ==
7.4/branches/noweb/
7.4/branches/noweb/platforms/debian/squeezebox.init
7.4/branches/noweb/platforms/readynas/rules
7.4/branches/noweb/platforms/readynas/squeezebox.init
7.4/branches/noweb/server/CPAN/Audio/Scan.pm
7.4/branches/noweb/server/CPAN/DBD/mysql/GetInfo.pm
7.4/branches/noweb/server/CPAN/DBD/mysql.pm
7.4/branches/noweb/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/Audio/Scan/Scan.dll
7.4/branches/noweb/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/mysql.dll
7.4/branches/noweb/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/branches/noweb/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/branches/noweb/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/branches/noweb/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/branches/noweb/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/branches/noweb/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/branches/noweb/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/branches/noweb/server/CPAN/arch/5.8/sparc-linux/auto/Audio/Scan/Scan.so
7.4/branches/noweb/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/branches/noweb/server/Slim/Utils/ImageResizer.pm
7.4/branches/noweb/server/Slim/Utils/Update.pm
7.4/branches/noweb/server/Slim/Web/Graphics.pm
7.4/branches/noweb/server/modules.conf
7.4/branches/noweb/tests/t/05resizer.t

 == Added 2 files total ==
7.4/branches/noweb/tests/data/images/ref/tall-cover-13x100.jpg
7.4/branches/noweb/tests/data/images/ref/wide-cover-100x12.jpg

 == Removed 2 files total ==
7.4/branches/noweb/platforms/readynas/CPAN/DBD/
7.4/branches/noweb/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/libmysql.dll
Comment 9 Andy Grundman 2009-08-06 17:02:48 UTC
 == Automatic comment from SVN commit #28089 to Repository: slim ==
https://svn.slimdevices.com/slim?view=revision&revision=28089

 r57601@macbookpro (orig r28088):  andy | 2009-08-06 19:58:37 -0400
  r57579@macbookpro (orig r28080):  michael | 2009-08-06 02:38:06 -0400
  Bug: n/a
  Description: don't display download URL in web UI, unless we got an update message from SN including that URL. Don't check for downloads unless auto download is enabled.
  r57580@macbookpro (orig r28081):  andy | 2009-08-06 08:49:46 -0400
  Fixed Bug 13224 - simplify max mode, make it the default for everything, use it for pad mode.  Also added some more tests
  r57583@macbookpro (orig r28082):  andy | 2009-08-06 09:46:00 -0400
  Refactor S::W::Graphics to use ImageResizer
  r57596@macbookpro (orig r28083):  mwise | 2009-08-06 11:02:59 -0400
  Bug 13265: Should solve the shutdown issue.
  r57597@macbookpro (orig r28084):  mwise | 2009-08-06 11:45:22 -0400
  Bug 12962: Additional space at the end of the line caused the readynas init script to break.
  r57598@macbookpro (orig r28085):  andy | 2009-08-06 19:08:08 -0400
  Audio::Scan 0.28
  
  0.28    2009-08-06 19:00:00
          - Bug 13198, Changed the method for determining FLAC bitrate.
  
  0.27    2009-07-26 23:00:00
          - Added support for Musepack SV8 files.
          - Refactored Musepack code to use buffer API, fixes
            crashes on big-endian platforms.
          - Added support for reading Musepack track gain and album gain.
  r57599@macbookpro (orig r28086):  andy | 2009-08-06 19:41:16 -0400
  Fixed Bug 13252 - downgrade DBD::mysql to 3.0002 to fix crasher
 



 == Modified 20 files total ==
7.4/branches/noweb-sqlite/
7.4/branches/noweb-sqlite/platforms/debian/squeezebox.init
7.4/branches/noweb-sqlite/platforms/readynas/rules
7.4/branches/noweb-sqlite/platforms/readynas/squeezebox.init
7.4/branches/noweb-sqlite/server/CPAN/Audio/Scan.pm
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/Audio/Scan/Scan.dll
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/mysql.dll
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb-sqlite/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/branches/noweb-sqlite/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb-sqlite/server/CPAN/arch/5.8/sparc-linux/auto/Audio/Scan/Scan.so
7.4/branches/noweb-sqlite/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/branches/noweb-sqlite/server/Slim/Utils/ImageResizer.pm
7.4/branches/noweb-sqlite/server/Slim/Utils/Update.pm
7.4/branches/noweb-sqlite/server/Slim/Web/Graphics.pm
7.4/branches/noweb-sqlite/server/modules.conf
7.4/branches/noweb-sqlite/tests/t/05resizer.t

 == Added 2 files total ==
7.4/branches/noweb-sqlite/tests/data/images/ref/tall-cover-13x100.jpg
7.4/branches/noweb-sqlite/tests/data/images/ref/wide-cover-100x12.jpg

 == Removed 2 files total ==
7.4/branches/noweb-sqlite/platforms/readynas/CPAN/DBD/
7.4/branches/noweb-sqlite/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/libmysql.dll
Comment 10 Andy Grundman 2009-08-06 17:09:59 UTC
 == Automatic comment from SVN commit #28090 to Repository: slim ==
https://svn.slimdevices.com/slim?view=revision&revision=28090

 r57579@macbookpro (orig r28080):  michael | 2009-08-06 02:38:06 -0400
 Bug: n/a
 Description: don't display download URL in web UI, unless we got an update message from SN including that URL. Don't check for downloads unless auto download is enabled.
 r57580@macbookpro (orig r28081):  andy | 2009-08-06 08:49:46 -0400
 Fixed Bug 13224 - simplify max mode, make it the default for everything, use it for pad mode.  Also added some more tests
 r57583@macbookpro (orig r28082):  andy | 2009-08-06 09:46:00 -0400
 Refactor S::W::Graphics to use ImageResizer
 r57596@macbookpro (orig r28083):  mwise | 2009-08-06 11:02:59 -0400
 Bug 13265: Should solve the shutdown issue.
 r57597@macbookpro (orig r28084):  mwise | 2009-08-06 11:45:22 -0400
 Bug 12962: Additional space at the end of the line caused the readynas init script to break.
 r57598@macbookpro (orig r28085):  andy | 2009-08-06 19:08:08 -0400
 Audio::Scan 0.28
 
 0.28    2009-08-06 19:00:00
         - Bug 13198, Changed the method for determining FLAC bitrate.
 
 0.27    2009-07-26 23:00:00
         - Added support for Musepack SV8 files.
         - Refactored Musepack code to use buffer API, fixes
           crashes on big-endian platforms.
         - Added support for reading Musepack track gain and album gain.
 r57599@macbookpro (orig r28086):  andy | 2009-08-06 19:41:16 -0400
 Fixed Bug 13252 - downgrade DBD::mysql to 3.0002 to fix crasher



 == Modified 27 files total ==
7.4/private-branches/fab4/
7.4/private-branches/fab4/platforms/debian/squeezebox.init
7.4/private-branches/fab4/platforms/readynas/rules
7.4/private-branches/fab4/platforms/readynas/squeezebox.init
7.4/private-branches/fab4/server/CPAN/Audio/Scan.pm
7.4/private-branches/fab4/server/CPAN/DBD/mysql/GetInfo.pm
7.4/private-branches/fab4/server/CPAN/DBD/mysql.pm
7.4/private-branches/fab4/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/Audio/Scan/Scan.dll
7.4/private-branches/fab4/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/mysql.dll
7.4/private-branches/fab4/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/private-branches/fab4/server/CPAN/arch/5.10/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/private-branches/fab4/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/fab4/server/CPAN/arch/5.10/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/fab4/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/fab4/server/CPAN/arch/5.10/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/fab4/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/Audio/Scan/Scan.bundle
7.4/private-branches/fab4/server/CPAN/arch/5.8/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
7.4/private-branches/fab4/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/fab4/server/CPAN/arch/5.8/i386-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/fab4/server/CPAN/arch/5.8/sparc-linux/auto/Audio/Scan/Scan.so
7.4/private-branches/fab4/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/Audio/Scan/Scan.so
7.4/private-branches/fab4/server/CPAN/arch/5.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
7.4/private-branches/fab4/server/Slim/Utils/ImageResizer.pm
7.4/private-branches/fab4/server/Slim/Utils/Update.pm
7.4/private-branches/fab4/server/Slim/Web/Graphics.pm
7.4/private-branches/fab4/server/modules.conf
7.4/private-branches/fab4/tests/t/05resizer.t

 == Added 2 files total ==
7.4/private-branches/fab4/tests/data/images/ref/tall-cover-13x100.jpg
7.4/private-branches/fab4/tests/data/images/ref/wide-cover-100x12.jpg

 == Removed 2 files total ==
7.4/private-branches/fab4/platforms/readynas/CPAN/DBD/
7.4/private-branches/fab4/server/CPAN/arch/5.10/MSWin32-x86-multi-thread/auto/DBD/mysql/libmysql.dll
Comment 11 James Richardson 2009-10-05 16:44:14 UTC
This bug has been fixed in the latest release of MySqueezebox.com (formally known as SqueezeNetwork)!

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.