本文整理汇总了PHP中ewww_image_optimizer_jpg_quality函数的典型用法代码示例。如果您正苦于以下问题:PHP ewww_image_optimizer_jpg_quality函数的具体用法?PHP ewww_image_optimizer_jpg_quality怎么用?PHP ewww_image_optimizer_jpg_quality使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewww_image_optimizer_jpg_quality函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewww_image_optimizer_options
//.........这里部分代码省略.........
</td></tr>
<tr><th><label for="ewww_image_optimizer_jpg_to_png"><?php
printf(__('enable %s to %s conversion', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'JPG', 'PNG');
?>
</label></th><td><span><input type="checkbox" id="ewww_image_optimizer_jpg_to_png" name="ewww_image_optimizer_jpg_to_png" <?php
if (ewww_image_optimizer_get_option('ewww_image_optimizer_jpg_to_png') == TRUE) {
?>
checked="true"<?php
}
?>
/> <b><?php
_e('WARNING:', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</b> <?php
_e('Removes metadata and increases cpu usage dramatically.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<p class="description"><?php
_e('PNG is generally much better than JPG for logos and other images with a limited range of colors. Checking this option will slow down JPG processing significantly, and you may want to enable it only temporarily.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p></td></tr>
<tr><th><label for="ewww_image_optimizer_png_to_jpg"><?php
printf(__('enable %s to %s conversion', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'PNG', 'JPG');
?>
</label></th><td><span><input type="checkbox" id="ewww_image_optimizer_png_to_jpg" name="ewww_image_optimizer_png_to_jpg" <?php
if (ewww_image_optimizer_get_option('ewww_image_optimizer_png_to_jpg') == TRUE) {
?>
checked="true"<?php
}
?>
/> <b><?php
_e('WARNING:', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</b> <?php
_e('This is not a lossless conversion.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<p class="description"><?php
_e('JPG is generally much better than PNG for photographic use because it compresses the image and discards data. PNGs with transparency are not converted by default.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<span><label for="ewww_image_optimizer_jpg_background"> <?php
_e('JPG background color:', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> #<input type="text" id="ewww_image_optimizer_jpg_background" name="ewww_image_optimizer_jpg_background" class="small-text" value="<?php
echo ewww_image_optimizer_jpg_background();
?>
" /> <span style="padding-left: 12px; font-size: 12px; border: solid 1px #555555; background-color: #<?php
echo ewww_image_optimizer_jpg_background();
?>
"> </span> <?php
_e('HEX format (#123def)', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
.</span>
<p class="description"><?php
_e('Background color is used only if the PNG has transparency. Leave this value blank to skip PNGs with transparency.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<span><label for="ewww_image_optimizer_jpg_quality"><?php
_e('JPG quality level:', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="text" id="ewww_image_optimizer_jpg_quality" name="ewww_image_optimizer_jpg_quality" class="small-text" value="<?php
echo ewww_image_optimizer_jpg_quality();
?>
" /> <?php
_e('Valid values are 1-100.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<p class="description"><?php
_e('If JPG quality is blank, the plugin will attempt to set the optimal quality level or default to 92. Remember, this is a lossy conversion, so you are losing pixels, and it is not recommended to actually set the level here unless you want noticable loss of image quality.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p></td></tr>
<tr><th><label for="ewww_image_optimizer_gif_to_png"><?php
printf(__('enable %s to %s conversion', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'GIF', 'PNG');
?>
</label></th><td><span><input type="checkbox" id="ewww_image_optimizer_gif_to_png" name="ewww_image_optimizer_gif_to_png" <?php
if (ewww_image_optimizer_get_option('ewww_image_optimizer_gif_to_png') == TRUE) {
?>
checked="true"<?php
}
?>
/> <?php
_e('No warnings here, just do it.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<p class="description"> <?php
_e('PNG is generally better than GIF, but animated images cannot be converted.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p></td></tr>
</table>
</div></div>
<p class="submit"><input type="submit" class="button-primary" value="<?php
_e('Save Changes', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" /></p>
</form>
<p>I recommend hosting your Wordpress site with <a href="http://www.dreamhost.com/r.cgi?132143">Dreamhost.com</a> or <a href="http://www.bluehost.com/track/nosilver4u">Bluehost.com</a>. Using these referral links will allow you to support future development of this plugin: <a href=http://www.dreamhost.com/r.cgi?132143">Dreamhost</a> | <a href="http://www.bluehost.com/track/nosilver4u">Bluehost</a>. Alternatively, you can contribute directly by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MKMQKCBFFG3WW">donating with Paypal</a>.</p>
</div>
<?php
}
示例2: ewww_image_optimizer
//.........这里部分代码省略.........
$type = 'image/png';
// successful conversion and we store the increment
$converted = $filenum;
} else {
$ewww_debug .= "converted PNG is no good<br>";
// otherwise delete the PNG
$converted = FALSE;
if (is_file($pngfile)) {
unlink($pngfile);
}
}
}
ewww_image_optimizer_webp_create($file, $new_size, $type, $tools['WEBP']);
break;
case 'image/png':
// png2jpg conversion is turned on, and the image is in the wordpress media library
if ((ewww_image_optimizer_get_option('ewww_image_optimizer_png_to_jpg') || !empty($_GET['ewww_convert'])) && $gallery_type == 1 && !$skip_lossy) {
$ewww_debug .= "PNG to JPG conversion turned on<br>";
// if the user set a fill background for transparency
$background = '';
if ($background = ewww_image_optimizer_jpg_background()) {
// set background color for GD
$r = hexdec('0x' . strtoupper(substr($background, 0, 2)));
$g = hexdec('0x' . strtoupper(substr($background, 2, 2)));
$b = hexdec('0x' . strtoupper(substr($background, 4, 2)));
// set the background flag for 'convert'
$background = "-background " . '"' . "#{$background}" . '"';
} else {
$r = '';
$g = '';
$b = '';
}
// if the user manually set the JPG quality
if ($quality = ewww_image_optimizer_jpg_quality()) {
// set the quality for GD
$gquality = $quality;
// set the quality flag for 'convert'
$cquality = "-quality {$quality}";
} else {
$cquality = '';
$gquality = '92';
}
// if this is a resize version
if ($converted) {
// just replace the file extension with a .jpg
$jpgfile = preg_replace('/\\.\\w+$/', '.jpg', $file);
// if this is a full version
} else {
// construct the filename for the new JPG
list($jpgfile, $filenum) = ewww_image_optimizer_unique_filename($file, '.jpg');
}
} else {
$ewww_debug .= "PNG to JPG conversion turned off<br>";
// turn the conversion process OFF
$convert = false;
$jpgfile = '';
$r = null;
$g = null;
$b = null;
$gquality = null;
}
// check for previous optimization, so long as the force flag is on and this isn't a new image that needs converting
if (empty($_REQUEST['ewww_force']) && !($new && $convert)) {
if ($results_msg = ewww_image_optimizer_check_table($file, $orig_size)) {
return array($file, $results_msg, $converted, $original);
}
示例3: ewww_image_optimizer_options
//.........这里部分代码省略.........
if (get_site_option('ewww_image_optimizer_optipng_level') == 7) {
echo ' selected="selected"';
}
?>
>Level 7: 240 trials</option>
</select> (default=2)</span>
<p class="description">According to the author of optipng, 10 trials should satisfy most people, 30 trials should satisfy everyone.</p></td></tr>
<tr><th><label for="ewww_image_optimizer_pngout_level">pngout optimization level</label></th>
<td><span><select id="ewww_image_optimizer_pngout_level" name="ewww_image_optimizer_pngout_level">
<option value="0"<?php
if (get_site_option('ewww_image_optimizer_pngout_level') == 0) {
echo ' selected="selected"';
}
?>
>Level 0: Xtreme! (Slowest)</option>
<option value="1"<?php
if (get_site_option('ewww_image_optimizer_pngout_level') == 1) {
echo ' selected="selected"';
}
?>
>Level 1: Intense (Slow)</option>
<option value="2"<?php
if (get_site_option('ewww_image_optimizer_pngout_level') == 2) {
echo ' selected="selected"';
}
?>
>Level 2: Longest Match (Fast)</option>
<option value="3"<?php
if (get_site_option('ewww_image_optimizer_pngout_level') == 3) {
echo ' selected="selected"';
}
?>
>Level 3: Huffman Only (Faster)</option>
</select> (default=2)</span>
<p class="description">If you have CPU cycles to spare, go with level 0</p></td></tr>
</table>
<h3>Conversion Settings</h3>
<p>
Conversion is not available in NextGEN or GRAND FlAGallery.
By default, all images have a link available in the media library for one-time conversion. Turning on individual conversion operations below will enable conversion filters any time an image is uploaded or modified.<br />
<b>NOTE:</b> The plugin will attempt to update image locations for any posts that contain the images. You may need to manually update locations/urls for converted images.
</p>
<table class="form-table">
<tr><th><label for="ewww_image_optimizer_disable_convert_links">Hide Conversion Links</label</th><td><input type="checkbox" id="ewww_image_optimizer_disable_convert_links" name="ewww_image_optimizer_disable_convert_links" <?php
if (get_site_option('ewww_image_optimizer_disable_convert_links') == TRUE) {
?>
checked="true"<?php
}
?>
/> Site or Network admins can use this to prevent other users from using the conversion links in the Media Library which bypass the settings below.</td></tr>
<tr><th><label for="ewww_image_optimizer_delete_originals">Delete originals</label></th><td><input type="checkbox" id="ewww_image_optimizer_delete_originals" name="ewww_image_optimizer_delete_originals" <?php
if (get_site_option('ewww_image_optimizer_delete_originals') == TRUE) {
?>
checked="true"<?php
}
?>
/> This will remove the original image from the server after a successful conversion.</td></tr>
<tr><th><label for="ewww_image_optimizer_jpg_to_png">enable <b>JPG</b> to <b>PNG</b> conversion</label></th><td><span><input type="checkbox" id="ewww_image_optimizer_jpg_to_png" name="ewww_image_optimizer_jpg_to_png" <?php
if (get_site_option('ewww_image_optimizer_jpg_to_png') == TRUE) {
?>
checked="true"<?php
}
?>
/> <b>WARNING:</b> Removes metadata! Requires GD or ImageMagick and should be used sparingly.</span>
<p class="description">PNG is generally much better than JPG for logos and other images with a limited range of colors. Checking this option will slow down JPG processing significantly, and you may want to enable it only temporarily.</p></td></tr>
<tr><th><label for="ewww_image_optimizer_png_to_jpg">enable <b>PNG</b> to <b>JPG</b> conversion</label></th><td><span><input type="checkbox" id="ewww_image_optimizer_png_to_jpg" name="ewww_image_optimizer_png_to_jpg" <?php
if (get_site_option('ewww_image_optimizer_png_to_jpg') == TRUE) {
?>
checked="true"<?php
}
?>
/> <b>WARNING:</b> This is not a lossless conversion and requires GD or ImageMagick.</span>
<p class="description">JPG is generally much better than PNG for photographic use because it compresses the image and discards data. PNGs with transparency are not converted by default.</p>
<span><label for="ewww_image_optimizer_jpg_background">JPG background color:</label> #<input type="text" id="ewww_image_optimizer_jpg_background" name="ewww_image_optimizer_jpg_background" class="small-text" value="<?php
echo ewww_image_optimizer_jpg_background();
?>
" /> <span style="padding-left: 12px; font-size: 12px; border: solid 1px #555555; background-color: #<?php
echo ewww_image_optimizer_jpg_background();
?>
"> </span> HEX format (#123def).</span>
<p class="description">This is used only if the PNG has transparency. Leave this value blank to skip PNGs with transparency.</p>
<span><label for="ewww_image_optimizer_jpg_quality">JPG quality level:</label> <input type="text" id="ewww_image_optimizer_jpg_quality" name="ewww_image_optimizer_jpg_quality" class="small-text" value="<?php
echo ewww_image_optimizer_jpg_quality();
?>
" /> Valid values are 1-100.</span>
<p class="description">If left blank, the plugin will attempt to set the optimal quality level or default to 92. Remember, this is a lossy conversion, so you are losing pixels, and it is not recommended to actually set the level here unless you want noticable loss of image quality.</p></td></tr>
<tr><th><label for="ewww_image_optimizer_gif_to_png">enable <b>GIF</b> to <b>PNG</b> conversion</label></th><td><input type="checkbox" id="ewww_image_optimizer_gif_to_png" name="ewww_image_optimizer_gif_to_png" <?php
if (get_site_option('ewww_image_optimizer_gif_to_png') == TRUE) {
?>
checked="true"<?php
}
?>
/>
<p class="description"> PNG is generally much better than GIF, but animated images cannot be converted.</p></td></tr>
</table>
<p class="submit"><input type="submit" class="button-primary" value="Save Changes" /></p>
</form>
</div>
<?php
}