Upload three versions of an image, full size, thumbnail and resized
So far, I've been uploading one image by hand (FTP to the server when live, locally moving a file), and then resizing them on the fly using the img
tag's width
and height
properties to resize them. Well, the images don't look good, because I need a square,开发者_如何学运维 cropped 100px version as a thumbnail, and then a 800px wide version for the view image page, and then finally the full-size original image for HD viewing, but I also need to apply a watermark, but only to the full res version. And I need help with an image upload script. Any sort of file upload, really. I've looked at tutorials, and they don't seem to make too much sense. Furthermore, I need to drop all three versions into a database row (which I think I can figure out). I know that I need to use something like $_FILE to do it, but I'm just really confused to the actual usage and the cropping/resizing/watermarking part really has me stumped. Solutions, anyone?
File uploading
- Upload using a simple HTML form and use PHP to manipulate the image. Example
- Read all the images stored in a directory and convert them in a batch. Example
Image re-sizing
- Use ImageMagick or GD library to resize images. Example
- Use any of the same libraries to watermark the images. Example
In all, you need to combine all these in order to upload, resize and watermark all in one go.
For the resizing, watermark etc, you should look at ImageMagic
精彩评论