if (settings.maxw && photo.width > settings.maxw) {
                            // Reduce to the max width || max height
                            percent = (photo.width - settings.maxw) / photo.width;
                            if (photo.height - (photo.height * percent) > settings.maxh) {
                                // Still too big, do it by height