php imagecopyresampled poor quality

后端 未结 4 1701
暖寄归人
暖寄归人 2020-12-09 12:17

I have a php script which saves the original image, then resizes it - one thumbnail and one larger image for web viewing. This works well except with some images the quality

4条回答
  •  暖寄归人
    2020-12-09 12:43

    The quick an dirty trick is to make the thumbnails 1000 x 1000 pixels (or more) on imagecopyresized() then set the JPEG quality to 20 or less on imagejpeg($img, $savePath, 20);. The output will usually be smaller than 100 kb.

    Let the client CSS do the resizing and the pictures will be fast to load and look flawless in modern browsers when scaled to thumbnail size.

提交回复
热议问题