PHP image thumbnail Implementation method,
Function: Support jpg,jpeg,gif,png,bmp picture format, support the scale of the original picture, you can choose whether to cut the picture in the process of image zooming, add the picture quality control, can achieve the highest quality of thumbnail image. The code for the complete class is as follows:
Php/** * Function: PHP generated
Share a php Image Upload class written by a netizen. It supports adding watermarks to generate a thumbnail. It includes configuration and information that can be obtained (each configuration information has a default value, if you do not have special requirements, do not configure them ):
The Code is as follows:
Copy code
/*----------------------------------------------------------------------------------**---------------------
This tutorial will explain how to create a flight thumbnail that uses PHP. In addition you will learn how to handle the entire folder of images and create your own thumbnails. Since this requires the GD library, you will need to have at least one Guangdong 2.0.1 PHP installation enabled.
Below we will create a PHP script that contains two functions. Any directory provided by the first scan. JPG images, and for each one, create a specified folder
Because thinkphp3.2.3 does not have a uploadfile,uploadimage class, it needs to be extracted from the expansion pack and added to it, putting them in the Thinkphp\library\think directory.Private Function_upload ($path, $width, $height)//Private method standard naming method_fun (){$obj =New\think\uploadfile ();//Instantiate file Upload class$objmaxSize= C (' Upload_max_size ');//picture max upload size$objSavepath= C (' Upload_path '). $path.'/';//File Upload save path$objSaverule=' Uniqid ';//S
Image processing: the implementation of watermarking and thumbnails (custom functions: watermark and thumbnail) code is a bit long, but not complex. Don't talk nonsense. paste the code:
The code is as follows:
/************************************// Function: watermark ($ bigimg, $ smallimg, $ coord = 1)// Function: add a watermark// Parameters:$ Bigimg is required. Large Image-watermark image$ Smallimg is required. Small image$ Coord is optional
functions.php Add the following code/** * WordPress background article List settings article featured image (thumbnail) Integrated version * Plugin name:easy Thumbnail switcher*/classDoocii_easy_thumbnail_switcher { Public $add _new_str; Public $change _str; Public $remove _str; Public $upload _title; Public $upload _add; Public $confirm _str; Public function__construct () {$this-GT;ADD_NEW_STR = __ (
/**
* Upload Images
*/
Class imgupload{
static protected $a;
protected $formName; Form name
protected $directory; File Upload to Directory
protected $maxSize; Maximum file Upload size
protected $canUpload; Whether you can upload
protected $doUpFile; File name of the upload
protected $SM _file; Thumbnail name
Private function __construct ($_formname= ' file ', $_directory= './images/uploads/'
See on the internet about CI upload images and generate thumbnails and watermark method is more as follows
The first step upload the original image before uploading local files for abc.jpg after uploading the file name is 123.jpgThe second step uses the previous step uploaded image 123.jpg to generate a thumbnail image 123_t.jpgThe third step in the above thumbnail image 123_t.jpg plus watermark
Eventually
This generates the thumbnail code, want it to be 600 width, and then the height proportionally how to get it????
The code is on-line, the author notes that can be proportional!
But I set the height to 0, and it doesn't work. Can only be set fixed!
Now I want to make the width 600, the height is proportional. How do you get it???
/*** Generate thumbnail functions (supported image formats: GIF, JPEG, PNG,
Parsing angular in github step-12 using events to achieve thumbnail switching effect, githubstep-12
In-depth parsing of thumbnails switching in angular's event processing mechanism step-12
1. First, check the page Effect
On the page, click the small thumbnail on the right. The picture on the left can be dynamically switched. How can this be achieved?
II. Implementation ideas:
1. Import angular-animate.
It was often done with bitmap, drawable, and canvas, and it was necessary to write a series of complicated logic to narrow down the original image to get a thumbnail image.Now I will introduce a relatively simple method: (online)In the Android 2.2 version, a new Thumbnailutils tool class is implemented to implement thumbnails, the functionality of this tool class is powerful, the use is simple, it provides a constant and three methods. With these cons
Recently in a collection of rich media features in a project. Need to upload video. Here I would like to make an asynchronous upload, and have a progress bar, the response has status code, video connection, thumbnails.
Service-side response
{
"thumbnail": "/slsxpt//upload/thumbnail/fdceefc.jpg",
"Success": True,
"link": "/slsxpt//upload/ Video/fdceefc.mp "
}
And I want my input file
Copy Code code as follows:
/*
* @im//need scaled picture resources
* @filetype//made thumbnail file type
* @dstimW//Zoom width of the picture
* @dstimH//Zoom height of the picture
* @thumbname//thumbnail file name
function Makethumb ($im, $dstimW, $dstimH, $thumbname, $filetype) {
Get the width and height of IM
$pic _w=imagesx ($im);
$pic _h=imagesy ($im);
$arr = Array ();
Swith ($filetype)
This example describes the thumbnail preview slider for jquery implementations. Share to everyone for your reference. Specifically as follows:
The effect is as shown in the following illustration:
The main code is as follows:
(function ($) {$.fn.thumbnailslider = function (options) {var opts = $.extend ({}, $.fn.thumbnailslider.defaults, Options)
; Return This.each (function () {var $this = $ (this), o = $.meta? $.extend ({}, OPTs, $pxs _cont
How to enable or disable thumbnail preview images in Win7
Some Win7 system users cannot preview images by using thumbnails when previewing images. How can they enable or disable image preview in the form of thumbnails? The following describes how to enable or disable a thumbnail preview image.
To enable or disable a thumbnail preview image, follow these steps:
It was often done with bitmap, drawable, and canvas, and it was necessary to write a series of complicated logic to narrow down the original image to get a thumbnail image.Now I will introduce a relatively simple method: (online)In the Android 2.2 version, a new Thumbnailutils tool class is implemented to implement thumbnails, the functionality of this tool class is powerful, the use is simple, it provides a constant and three methods. With these cons
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.