Jump to content


Slice Image with PHP

  • Please log in to reply
1 reply to this topic

#1 fcarentz

  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 March 2006 - 03:57 PM

Hey everyone. Working on a gallery type site currently and running into a problem.

In the gallery I want to display thumbnails before the user selects which pic they want to view the full image of.

However, a regular resizing is not what I'm after. I want to crop out a portion of the full size image to create a new picture to be used as a thumb.

check here [a href=\"http://www.gfxartist.com/community/member_galleries\" target=\"_blank\"]http://www.gfxartist.com/community/member_galleries[/a]

you will notice the smaller 64x64 thumbs are actually cut from a larger picture. So heres one of my issues that I can't seem to figure out as I am not familiar at all with the image functions of php or the gd library, which is installed on my server.

How can I make slices and have the code determine where to slice...I was thinking I could do this by reading the file and finding where the most concetrated work is and slice a 64x64 square from that area.

If anyone has any suggestions or can point me to any tutorials or code snippets that would be great!


#2 ToonMariner

  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 03 March 2006 - 04:14 PM

writing code to find the section to cut out is difficult!

what you can do in php is resample the entire graphic to make a smaller version of it. I have an upload class wirtten that you can ave that does this - just trying to find it - could take me a while. PM me later on and I will e-mail it to you with instructions.
follow me on twitter @PHPsycho

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users