PHP Thumbnail Class

后端 未结 3 1376
难免孤独
难免孤独 2021-02-10 07:40

I am looking for a solid PHP thumbnail generating class. Does anyone know any good ones that are open-source?

I could write one, but I really don\'t want to. The one thi

相关标签:
3条回答
  • 2021-02-10 08:20

    use class.upload.php

    see this link for details may be its help you more

    http://www.verot.net/php_class_upload_samples.htm

    0 讨论(0)
  • 2021-02-10 08:32

    Use phpThumb(). Its a script that internally uses GD library and/or ImageMagick (whichever is available and whichever it thinks is best for the job) to perform basic image manipulation tasks, including thumbnail generation and square thumbnail generation.

    You can use it like this:

    <!-- best fit -->
    <img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64">
    <!-- crop fit (square thumbnails) -->
    <img src="/phpThumb/phpThumb.php?src=/path/to/image.jpg&w=64&h=64&zc=1">
    

    It has built in caching engine so second time a browser requests the above image it is served from its own cache instead of re-generating the thumbnail every time. Though, you may want to spend an hour or so configuring it.

    0 讨论(0)
  • 2021-02-10 08:38

    Generating a thumbnail requires so little code that it is a "simple example" of the GD library's resizing functions in the manual:

    http://php.net/manual/en/function.imagecopyresampled.php

    Just copy and paste.

    0 讨论(0)
提交回复
热议问题