<?php namespace ImageOptimizer\TypeGuesser; class ExtensionTypeGuesser implements TypeGuesser public function guess($filepath) { $ext = strtolower(pathinfo($filepath, PATHINFO_EXTENSION)); switch($ext) { case 'png': return self::TYPE_PNG; case 'gif': return self::TYPE_GIF; case 'jpg': case 'jpeg': return self::TYPE_JPEG; default: return self::TYPE_UNKNOWN; } } }
Manipulate images: remove unnecessary colors, pixels, etc., for example, change the image from large to small. The requirement for web images is to publish images of the highest possible quality in the shortest possible transmission time. Therefore, when designing and processing web page images, it is required that the images have the highest possible resolution and the smallest possible size, so that the download speed of the images can be the fastest. To do this, the image must be optimized.
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
24Jun2016
Please tell me how to add a picture border to the picture and adjust the picture size
24Jun2016
[Emergency help] After the large picture obtains the small picture through coordinates, how to remove the border on the small picture?
24Jun2016
CSS3 vertical mouse move to picture picture scrolling, graphic menu code
06Jul2016
{Code...} The picture above is a picture with a width of 480 and a height of 270. Remove the suffix !w480h270 to access the original picture. Question: 1. How is this kind of picture usually stored on the server? Is it just the original picture? 2. Add the suffix !w480h270 to generate corresponding thumbnails. How thumbnails are generally stored...
24Jun2016
When inserting a picture into a TD in HTML, why can’t the picture fill the entire TD?
Hot Tools
PHP multifunctional image processing class
PHP multifunctional image processing class
PHP library for creating animated GIFs
PHP library for creating animated GIFs