You are here

pngquant.inc in Image Optimize (or ImageAPI Optimize) 7

Pngquant integration.

File

binaries/pngquant.inc
View source
<?php

/**
 * @file
 * Pngquant integration.
 */

/**
 * Implements imageapi_optimize_TYPE_NAME_info().
 */
function imageapi_optimize_binaries_pngquant_info() {
  return array(
    'title' => t('pngquant'),
    'url' => 'http://pngquant.org/',
    'type' => 'png',
    'weight' => 0,
  );
}

/**
 * Pngquant ImageAPI Optimize binary callback.
 */
function imageapi_optimize_binaries_pngquant($image, $dst, $cmd, $settings) {
  if ($image->info['mime_type'] == 'image/png') {
    exec("{$cmd} --speed=1 --quality=90-99 --force --ext .png " . escapeshellarg($dst));
  }
}

Functions

Namesort descending Description
imageapi_optimize_binaries_pngquant Pngquant ImageAPI Optimize binary callback.
imageapi_optimize_binaries_pngquant_info Implements imageapi_optimize_TYPE_NAME_info().