5
votes

Google provides an excellent way to resize images dynamically; simply append =sXX to the image URL. This is perfect if you want to shrink an image, but if the image is smaller than the size specified, it enlarges it, giving it a pixelated effect.

Is there an easy way to say "don't enlarge, only shrink" when using serving URLs with a specified size?

UPDATE

This functionality is now a feature request at GAE. Vote it up if you'd like to see it!

2
Unfortunately, no this can't be done. What is the need for this functionality? There may a different way to solve this problem. - RLH
The need is for simplicity. Using the =sXX notation is incredibly simple, and allows for you to move on from displaying images to more important tasks. Without it, all of your resizing has to be done server-side and conditions have to be checked; it makes the code more complicated. That's a shame when there's an elegant solution like this notation. - Matt Norris

2 Answers

1
votes

As stated in my comments above, this isn't possible.

Although I have no use of the image framework I can see how your request would be useful. May I suggest posting a Feature Request on the Google App Engines Issues BB?

After posting the request, update your StackOverflow question with a link to your Feature Request so that other users can +1 the request.

Here's the link to the GAE Issues Page. Although this is not a bug, you will need to click the New Issue button to request a feature.

1
votes

What you could do is store the size of the image in the datastore so when you need the image to be a certain size, you can check in the datastore to see what size it is and add the =sXX accordingly.