If you don’t have your images bigger than the size you wish to resize then its quality will be poor. If they are smaller in ‘both sides’ then use just the HTML to do it, it will look horrible though.
If it is one side bigger than the other you can use the method adaptiveResize of PHPThumb then it will try to resample the image to the dimensions…
I don’t really understand, what are the actual image size you wish to resize?
I highly recommend you that you suggest your users to upload images bigger than 125x125 and less than xMB. I am sure you have a filter that checks whether the image is such and such, here is mine:
public static function validateUploadedPicture( CUploadedFile $file, $maxWidth, $maxHeight, $minWidth, $minHeight, $mimeTypes ){
$info = @getimagesize( $file->getTempName() );
// remove unnecessary values from $info and make it more readable
$info = array(
'width' => $info[0],
'height' => $info[1],
'mime' => $info['mime'],
);
if ($info['width'] < $minWidth) {
return self::MIN_WIDTH_ERROR;
}
if ($info['width'] > $maxWidth) {
return self::MAX_WIDTH_ERROR;
}
if ($info['height'] < $minHeight) {
return self::MIN_HEIGHT_ERROR;
}
if ($info['height'] > $maxHeight) {
return self::MAX_HEIGHT_ERROR;
}
$mimeTypes = is_scalar($mimeTypes) ? array($mimeTypes) : $mimeTypes;
if (!in_array($info['mime'], $mimeTypes)) {
return self::MIME_TYPE_ERROR;
}
return self::PICTURE_VALID;
}
I call this function (i have my own constants as you see) I know that the image is ready to upload (I tried to use EPhotoValidator but no luck with it). Then, when I know that the file is ok to continue I do the resizing…