Does anyone have a function to create a preview image? But so that it is cut off (like VKontakte), i.e. An image of 560х400 allowed 560х400 decrease and then cropped to 100х100 .

  • imagecreatefromjpeg, imagecreatefrompng, - Vfvtnjd
  • In my question has already been somewhere. - atnartur

3 answers 3

    Solution using convert :

     convert /path/original/file.jpg -colors 8 -resize 100x100^ -gravity Center -crop 100x100+0+0 +repage /path/output/file.jpg 

      There was already a question on this topic: Help to implement image cropping in PHP .