Commit b96cf150 authored by Hai-Nam Nguyen's avatar Hai-Nam Nguyen
Browse files

Add support for advpng

parent bf820d20
......@@ -33,6 +33,14 @@ function imageapi_optimize_settings_form() {
'#element_validate' => array('imageapi_optimize_toolkit_element_validate'),
);
$form['imageapi_optimize_advpng'] = array(
'#type' => 'textfield',
'#title' => t('Path to advpng'),
'#default_value' => variable_get('imageapi_optimize_avipng', ''),
'#element_validate' => array('imageapi_optimize_validate_path'),
'#description' => t('Leave empty to skip this command. You can download it <a href="!link">here</a> (part of AdvanceCOMP).', array('!link' => 'http://advancemame.sourceforge.net/comp-download.html')),
);
$form['imageapi_optimize_optipng'] = array(
'#type' => 'textfield',
'#title' => t('Path to optipng'),
......@@ -160,6 +168,9 @@ function _imageapi_optimize_check_path($path) {
function _imageapi_optimize_optimize($image, $dst) {
switch ($image->info['mime_type']) {
case 'image/png':
if ($cmd = variable_get('imageapi_optimize_advpng', '')) {
exec("$cmd -z -4 -q $dst");
}
if ($cmd = variable_get('imageapi_optimize_optipng', '')) {
exec("$cmd -o5 $dst");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment