Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: jpeg_quality

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
154       * @param int $quality Compression Quality. Range: [1,100]
155       * @return boolean|WP_Error
156       */
157      public function set_quality( $quality = null ) {
158           if ( !$quality )
159                $quality = $this->quality;
160
161           try {
162                if( 'image/jpeg' == $this->mime_type ) {
163                     $this->image->setImageCompressionQuality( apply_filters( 'jpeg_quality', $quality, 'image_resize' ) );
164                     $this->image->setImageCompression( imagick::COMPRESSION_JPEG );
165                }
166                else {
167                     $this->image->setImageCompressionQuality( $quality );
168                }
169           }
170           catch ( Exception $e ) {
171                return new WP_Error( 'image_quality_error', $e->getMessage() );
172           }