I don't think you should ever resize images using code. Also, if your image is a thumbnail and you like to have a larger view of it, the image itself would get pixelated. You might be able to get away with it if your original image has the largest resolution it will ever take, you won't lose quality if you reduce it's size. But remember; the thumbnail although reduced in resolution will still have the same KB as if it was being displayed in its original size.
There are a few cases when it can be sensible to resize with the browser.
One is when you are using the same image at more than one size on a page. Then it makes sense to download the image once (a file at the largest resolution you need) and use the browser to resize the same image for the smaller versions.
Another time is when you have an image file that will not pixelate -- because everything is at right angles (or even just a solid color). Then it makes sense to create a small version of the image and size up to a larger rendering using the browser dimensions.