This add-on is operated by Zara 4
Compress images by up to 90% with no visible loss of quality.
Zara 4
Last updated November 24, 2023
The Zara 4 add-on is currently in beta.
Table of Contents
Zara 4 is a powerful image compression service that can reduce the file-size of your images by up to 90% with no visible loss of quality.
Images are the largest component of data transfer for the majority of websites. By using Zara 4 to compress your images you can significantly reduce the amount of data visitors to your site download. Less data to download equals improved user experience and fast loading pages.
Reducing the amount of data you transfer sending images reduces the load on your servers, and can save you money in data transfer and storage fees. Compressing your images can also improve your search engine optimisation as well as helping your site to be more mobile friendly.
Zara 4 currently supports JPEG, PNG, GIF (including animated) and SVG image formats.
Overview of features
Zara 4 offers:
- Image compression (up to and beyond 90% depending on the image)
- Image resizing (for JPEG and PNG)
- Color enhancement (for JPEG and PNG)
- Images load from blurry to sharp (for JPEG)
- Web interface
- Team support
- API access with SDK’s
- WordPress plugin
Zara 4 is accessible via an API and has supported client libraries for PHP and Java
Provisioning the add-on
Zara 4 can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
$ heroku addons:create zara-4
-----> Adding zara-4 to sharp-mountain-4005... done, v18 (free)
Once Zara 4 has been added a ZARA_4_API_CLIENT_ID
and ZARA_4_API_CLIENT_SECRET
setting will be available in the app configuration, containing the API credentials used to authenticate your application. This can be confirmed using the heroku config:get
command.
$ heroku config:get ZARA_4_API_CLIENT_ID
iR7Bp771l8R13865NAvc444Jm2uEr33j96l22pEK
$ heroku config:get ZARA_4_API_CLIENT_SECRET
lAXyx6wnfU0jUvKhPuMorljFNxsXeqcO0eNrEPrn
After installing Zara 4 the application should be configured to fully integrate with the add-on.
Local setup
Environment setup
After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.
Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env
file. To view all of your app’s config vars, type heroku config
. Use the following command for each value that you want to add to your .env
file.
$ heroku config:get ZARA_4_API_CLIENT_ID -s >> .env
$ heroku config:get ZARA_4_API_CLIENT_SECRET -s >> .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env
file with: echo .env >> .gitignore
.
For more information, see the Heroku Local article.
API access
Zara 4 offers extensive API support allowing you to seamlessly integrate automated image compression into your applications. API access is included for all accounts giving you access to a powerful platform, capable of integrating with any application.
Your API credentials are stored as the config variables ZARA_4_API_CLIENT_ID
and ZARA_4_API_CLIENT_SECRET
. You can modify your API credentials for your account here.
The easiest way to integrate Zara 4 into your application is to to use our SDK’s
Using with PHP
To integrate Zara 4 into your PHP application download and install the Zara 4 PHP SDK into your application.
Local image
To process images on your local machine you should use a LocalImageRequest. This uploads the image from your machine to Zara 4 for processing.
use Zara4\API\Client;
use Zara4\API\ImageProcessing\LocalImageRequest;
use Zara4\API\ImageProcessing\ProcessedImage;
$apiClient = new Client(getenv("ZARA_4_API_CLIENT_ID"), getenv("ZARA_4_API_CLIENT_SECRET"));
$originalImage = new LocalImageRequest("/path/to/original-image.jpg");
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
Remote image
To process images from a remote location (such as a website url), you should use a RemoteImageRequest. This downloads the image from the remote location to Zara 4 for processing. The image url given must be publicly accessible.
use Zara4\API\Client;
use Zara4\API\ImageProcessing\RemoteImageRequest;
use Zara4\API\ImageProcessing\ProcessedImage;
$apiClient = new Client(getenv("ZARA_4_API_CLIENT_ID"), getenv("ZARA_4_API_CLIENT_SECRET"));
$originalImage = new RemoteImageRequest("https://example.com/original-image.jpg");
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
Options
You can customise how your images are processed with Zara 4 by altering your request options.
use Zara4\API\Client;
use Zara4\API\ImageProcessing\LocalImageRequest;
$apiClient = new Client(getenv("ZARA_4_API_CLIENT_ID"), getenv("ZARA_4_API_CLIENT_SECRET"));
$originalImage = new LocalImageRequest("/path/to/original-image.jpg");
// Change request options
$originalImage->optimisationMode = OptimisationMode::HIGHEST;
$originalImage->colourEnhancement = ColourEnhancement::IMPROVE_COLOUR;
$originalImage->resizeMode = ResizeMode::NONE;
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
Using with Java
To integrate Zara 4 into your Java application download and install the Zara 4 Java SDK into your application.
Local image
To process images on your local machine you should use a LocalImageRequest. This uploads the image from your machine to Zara 4 for processing.
import com.zara4.api.*;
Client apiClient = Client(System.getenv("ZARA_4_API_CLIENT_ID"), System.getenv("ZARA_4_API_CLIENT_SECRET"));
LocalImageRequest originalImage = new LocalImageRequest("/path/to/original-image.jpg");
ProcessedImage processedImage = apiClient.processImage(originalImage);
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg");
Remote image
To process images from a remote location (such as a website url), you should use a RemoteImageRequest. This downloads the image from the remote location to Zara 4 for processing. The image url given must be publicly accessible.
import com.zara4.api.*;
Client apiClient = Client(System.getenv("ZARA_4_API_CLIENT_ID"), System.getenv("ZARA_4_API_CLIENT_SECRET"));
RemoteImageRequest originalImage = new RemoteImageRequest("https://example.com/original-image.jpg");
ProcessedImage processedImage = apiClient.processImage(originalImage);
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg");
Options
You can customise how your images are processed with Zara 4 by altering your request options.
import com.zara4.api.*;
Client apiClient = Client(System.getenv("ZARA_4_API_CLIENT_ID"), System.getenv("ZARA_4_API_CLIENT_SECRET"));
LocalImageRequest originalImage = new LocalImageRequest("/path/to/original-image.jpg");
// Change request options
originalImage.optimisationMode = OptimisationMode.HIGHEST;
originalImage.colourEnhancement = ColourEnhancement.IMPROVE_COLOUR;
originalImage.resizeMode = ResizeMode.NONE;
ProcessedImage processedImage = apiClient.processImage(originalImage);
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg");
Using with Ruby
To integrate Zara 4 into your Ruby application download and install the Zara 4 Ruby SDK into your application.
Local image
To process images on your local machine you should use a LocalImageRequest. This uploads the image from your machine to Zara 4 for processing.
require 'zara4'
api_client = Zara4::API::Client.new({
'client_id' => ENV['ZARA_4_API_CLIENT_ID'],
'client_secret' => ENV['ZARA_4_API_CLIENT_SECRET']
})
original_image = Zara4::API::ImageProcessing::LocalImageRequest.new('/path/to/original-image.jpg')
processed_image = api_client.process_image(original_image)
api_client.download_processed_image(processed_image, '/where/to/save/compressed-image.jpg')
Remote image
To process images from a remote location (such as a website url), you should use a RemoteImageRequest. This downloads the image from the remote location to Zara 4 for processing. The image url given must be publicly accessible.
require 'zara4'
api_client = Zara4::API::Client.new({
'client_id' => ENV['ZARA_4_API_CLIENT_ID'],
'client_secret' => ENV['ZARA_4_API_CLIENT_SECRET']
})
original_image = Zara4::API::ImageProcessing::RemoteImageRequest.new('https://example.com/original-image.jpg')
processed_image = api_client.process_image(original_image)
api_client.download_processed_image(processed_image, '/where/to/save/compressed-image.jpg')
Options
You can customise how your images are processed with Zara 4 by altering your request options.
require 'zara4'
api_client = Zara4::API::Client.new({
'client_id' => ENV['ZARA_4_API_CLIENT_ID'],
'client_secret' => ENV['ZARA_4_API_CLIENT_SECRET']
})
original_image = Zara4::API::ImageProcessing::RemoteImageRequest.new('https://example.com/original-image.jpg')
original_image.optimisation_mode = Zara4::API::ImageProcessing::OptimisationMode::HIGHEST
original_image.colour_enhancement = Zara4::API::ImageProcessing::ColourEnhancement::IMPROVE_COLOUR
original_image.resize_mode = Zara4::API::ImageProcessing::ResizeMode::CROP
original_image.width = 250
original_image.height = 250
processed_image = api_client.process_image(original_image)
api_client.download_processed_image(processed_image, '/where/to/save/compressed-image.jpg')
Using with WordPress
If you’re running WordPress on Heroku, you can install Zara 4 in seconds by installing the Zara 4 WordPress Plugin. Enter your API credentials and the plugin will do the rest.
The Zara 4 WordPress plugin provides automatic image compression, meaning images are compressed as you upload them. You can restore your original (uncompressed) images at any time. Existing images can be compressed individually or batch processed by using the bulk action ‘Compress with Zara 4’ from the WordPress Media Library.
Dashboard
The Zara 4 dashboard let’s you view information about your account. You can monitor your image processing usage and change your account settings.
The dashboard can be accessed via the CLI:
$ heroku addons:open zara-4
Opening zara-4 for sharp-mountain-4005
or by visiting the Heroku Dashboard and selecting the application in question. Select Zara 4 from the Add-ons menu.
Web interface
Zara 4 provides a simple drag and drop web interface allowing you to upload images to be compressed manually. Access your account through Heroku and you can instantly start compressing your images.
Teams
Zara 4 is built for team working, allowing you to stay in control whilst giving your team access to compress their images.
Zara 4 allows you to share your image processing quota and data with other users invited to join your team. Team working is included for all accounts (even free) meaning you can invite anyone to work with you.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process.
Use the heroku addons:upgrade
command to migrate to a new plan.
$ heroku addons:upgrade zara-4:premium
-----> Upgrading zara-4:premium to sharp-mountain-4005... done, v18 ($21.75/mo)
Your plan has been updated to: zara-4:premium
Removing the add-on
Zara 4 can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy zara-4
-----> Removing zara-4 from sharp-mountain-4005... done, v20 (free)
Support
All Zara 4 support and runtime issues should be submitted via on of the Heroku Support channels. Any non-support related issues or product feedback is welcome please contact us or email us at support@zara4.com.