Jump to content

Thumbnail Generator


corbin

Recommended Posts

So I wanted to learn more about the GD library since I had hardly ever used it, and I figured I would do something productive in the process.

 

So what this does... It takes an image and depending on the configuration it either scales it down making it an image within and image so that the image is still square, or it just constrains proportions.  When it constrains proportions since both width and height can be input it uses which ever one is set to override the other in the config.  This would probably be easier to express in bullet form:

 

  • Make thumbs based on get vars sizes
  • can be chosen to constrain proportions or stretch the image
  • Lets say the image is 1000 by 500 and you want to scale it to 250 by 250... Obviously that stretches the image, but in the config you can set it to make space around the image so it's 250 by 250 but the image content from before is 250X125
  • When making it have space around it, you can control what color the extra space is via GET variables
  • Default variables can be assigned in the php file and you can choose whether to allow them being over ridden by GET or not
  • thumbs are cached in a folder chosen in config so that they do not need to be recreated every time.
  • jpg/jpeg support
  • png support
  • A multiple can be set so that the width/height can only be a multiple of X.  This can be handled two ways... It can be set to exit if its not a multiple, or it can go to the nearest multiple.

What I plan to add:

  • Being able to make GIF thumbs
  • being able to output GIF thumbs so that if wanted the area around the constrained proportions image can be transparent

 

Anyways I'll attach it... I should have the GIF stuff done before long (I'm bored lol)

 

I also made a like batch generator, but I plan to add the same features to it as to the individual one before I release it.

 

(examples at: http://corbin.no-ip.org/thumbgen/ )

 

[attachment deleted by admin]

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.