PHPackages                             karikas/blitline - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. karikas/blitline

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

karikas/blitline
================

Blitline API Wrapper

0.1.x-dev(12y ago)17.6kApache-2.0PHPPHP &gt;=5.3.2

Since Jul 21Pushed 12y ago1 watchersCompare

[ Source](https://github.com/peach-schnapps/blitline_php)[ Packagist](https://packagist.org/packages/karikas/blitline)[ RSS](/packages/karikas-blitline/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHP wrapper for Blitline API
============================

[](#php-wrapper-for-blitline-api)

This is a PHP wrapper for Blitline's cloud-based image processing API. I have nothing to do with Blitline but really wanted to use their system in our PHP code... hence this library.

Prerequisites
-------------

[](#prerequisites)

Before using this library, please ensure you have an application ID from Blitline - see [www.blitline.com](http://www.blitline.com) for details. You'll need to be running PHP 5.3 and have CURL installed, I believe that's it.

How to use this
---------------

[](#how-to-use-this)

First, get your API key. You can either pass this in when instantiating Blitline or set a constant called BLITLINE\_APP\_ID before instantiating your Blitline object. The workflow here is:

- Instantiate once
- Load image
- Set S3 destination information (optional)
- Add filters, in order of operation
- Optional - start another request and repeat the process. This allows multiple sets of operations with the same source file!
- Process

So, here's a basic example. This will take an image and resize it to 256x256, then apply default sharpening, and return the generated file location.

```
define('BLITLINE_APP_ID', 'YOUR-APP-ID-FROM-BLITLINE-DOT-COM');
include('lib/blitline_php.php');

$src = 'http://p.twimg.com/Atb2B0MCAAADLk6.jpg';

$Blit = new Blitline_php();
$Blit->load($src);
$Blit->do_resize_to_fill(256, 256);
$Blit->do_sharpen();

$results = $Blit->process();
if ($results->success()) {
	foreach($results->get_images() as $name => $url) {
		echo "Processed: {$name} at {$url}\n";
	}
} else {
	print_r($results->get_errors());
}
```

This example would make three thumbnails in different sizes and save them:

```
define('BLITLINE_APP_ID', 'YOUR-APP-ID-FROM-BLITLINE-DOT-COM');
include('lib/blitline_php.php');

$src = 'http://placekitten.com/1024/768';

$Blit = new Blitline_php();
$Blit->load($src, 'kitten-256.jpg'); // Passing in our own image identifier

// Resize 256 pixel image
$Blit->do_resize_to_fill(256, 256);

// 512 pixel image, sharpened, 45 % quality
$Blit->set_image_id('kitten-512.jpg');
$Blit->set_jpg_quality(45);
$Blit->do_resize_to_fit(512, 512);
$Blit->do_sharpen();

// One more tiny one for fun
$Blit->new_request();
$Blit->set_image_id('kitten-48.jpg');
$Blit->set_jpg_quality(75);
$Blit->do_resize_to_fill(48, 48);

$results = $Blit->process();
if ($results->success()) {
	foreach($results->get_images() as $name => $url) {
		echo "Processed: {$name} at {$url}\n";
	}
} else {
	print_r($results->get_errors());
}
```

...at this point there aren't many functions supported, but I wanted to get this library up as soon as it was working.

Want to save to an Amazon AWS S3 bucket?
----------------------------------------

[](#want-to-save-to-an-amazon-aws-s3-bucket)

You can also configure this to save to an S3 bucket. First, you'll need to follow Blitline's guide at [http://www.blitline.com/docs/s3\_permissions](http://www.blitline.com/docs/s3_permissions) to add permissions to your target S3 bucket before trying to save anything there.

Somewhere between instantiating the class and calling process(), set $Blit-&gt;set\_s3\_target($bucket, $key, $headers), where:

- $bucket is the name of your blitline-approved bucket
- $key is the key/filename to save it as. Note that "folders" work here as well.
- $headers is an optional associative array of additional header values. Refer to [http://www.blitline.com/docs/s3\_headers](http://www.blitline.com/docs/s3_headers) and

For example, a quickie would be:

```
$Blit = new Blitline_php('YOUR-API-KEY');
$Blit->load('http://img.gawkerassets.com/img/17wen4d92trn3jpg/original.jpg');
$Blit->set_s3_target('my-s3-bucket', 'thumbs/tranquil-countryside.jpg');
$Blit->do_resize_to_fill(72, 72);
$Blit->process();
```

Note that if you're doing multiple requests you need to set the S3 Target for each image you're saving, otherwise it'll recklessly overwrite the original each time.

You can also clear the s3 target by calling clear\_s3\_target().

Things to know
--------------

[](#things-to-know)

- Your source file absolutely has to come from a public URL, no local paths allowed.
- The image URLs returned by Blitline will NOT be valid when returned to you, Blitline queues the image processing so it may take up to several seconds for your images to appear there. To know if your image is really done processing, you would need to poll your job id, but that's not in this library yet.
- Want to see a log of everything that's happened so far? Call get\_log(); to return or get\_log(TRUE) to echo.
- Want to see a log of all ERRORS that've happened so far? Call get\_errors(); to return or get\_errors(TRUE) to echo.
- Want to see if an error has happened? Call error\_occurred(), returns TRUE/FALSE.
- Want to see the log/errors as you go? Call debug\_on() (there's also a debug\_off() )

To-do list
----------

[](#to-do-list)

- Add all additional filters/functions from the Blitline API
- Add support for saving down to 8 bit PNGs
- Add additional error checking
- Add support for polling
- Additional documentation

License
-------

[](#license)

The Apache License 2.0 applies to all code in this repository.

Copyright 2012 Michael Karikas

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Changelog
---------

[](#changelog)

0.1 Initial release, support for composite (image watermark/composite), resize\_to\_fill, resize\_to\_fit, trim, and sharpen.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4728d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22871?v=4)[Blake E](/maintainers/electblake)[@electblake](https://github.com/electblake)

---

Top Contributors

[![minioak](https://avatars.githubusercontent.com/u/1151320?v=4)](https://github.com/minioak "minioak (8 commits)")[![karikas](https://avatars.githubusercontent.com/u/2007512?v=4)](https://github.com/karikas "karikas (3 commits)")

---

Tags

image processingblitline

### Embed Badge

![Health badge](/badges/karikas-blitline/health.svg)

```
[![Health](https://phpackages.com/badges/karikas-blitline/health.svg)](https://phpackages.com/packages/karikas-blitline)
```

###  Alternatives

[imagine/imagine

Image processing for PHP

4.5k75.7M385](/packages/imagine-imagine)[rokka/imagine-vips

libvips adapter for imagine

43638.4k7](/packages/rokka-imagine-vips)[media-alchemyst/media-alchemyst

An Object Oriented wrapper for easy multimedia conversion, based on Imagine, FFMpeg, SwfTools, Unoconv and other libs

65218.9k1](/packages/media-alchemyst-media-alchemyst)[pixelandtonic/imagine

Image processing for PHP

133.5M7](/packages/pixelandtonic-imagine)[neutron/silex-imagine-provider

A Silex service provider for Imagine Image Processing Library

26201.8k3](/packages/neutron-silex-imagine-provider)[batdan/midjourney-api-php

Generate images Midjourney (Discord API). URLs in prompt accepted

222.2k](/packages/batdan-midjourney-api-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
