Photon Core

On-the-fly photo processing

Лицензия

Лицензия

Группа

Группа

com.thousandmemories.photon
Идентификатор

Идентификатор

photon-core
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Photon Core
On-the-fly photo processing
Ссылка на сайт

Ссылка на сайт

http://github.com/1000Memories/photon-core
Система контроля версий

Система контроля версий

http://github.com/1000Memories/photon-core

Скачать photon-core

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.thousandmemories.photon/photon-core/ -->
<dependency>
    <groupId>com.thousandmemories.photon</groupId>
    <artifactId>photon-core</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.thousandmemories.photon/photon-core/
implementation 'com.thousandmemories.photon:photon-core:0.1.0'
// https://jarcasting.com/artifacts/com.thousandmemories.photon/photon-core/
implementation ("com.thousandmemories.photon:photon-core:0.1.0")
'com.thousandmemories.photon:photon-core:jar:0.1.0'
<dependency org="com.thousandmemories.photon" name="photon-core" rev="0.1.0">
  <artifact name="photon-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.thousandmemories.photon', module='photon-core', version='0.1.0')
)
libraryDependencies += "com.thousandmemories.photon" % "photon-core" % "0.1.0"
[com.thousandmemories.photon/photon-core "0.1.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
org.imgscalr : imgscalr-lib jar 4.2
com.yammer.dropwizard : dropwizard-core jar 0.5.0

test (4)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.8.1
org.hamcrest : hamcrest-integration jar 1.2.1
com.yammer.dropwizard : dropwizard-testing jar 0.5.0
org.mockito : mockito-core jar 1.9.0

Модули Проекта

Данный проект не имеет модулей.

photon-core

On the fly photo processing

Photon-core provides a JAX-RS resource (com.thousandmemories.photon.core.PhotoResource) that processes (resizes, rotates, and crops) image files on the fly.

Read more about why we built it on our blog post (TODO: link blog post after it's live) or see it in use in an example at https://github.com/1000Memories/photon-example

PhotoResource

PhotoResource takes a path like /1234.jpg;w=200;r=180;c=130,60,200,300, fetches the image named 1234.jpg using a PhotoProvider, processes the image according the matrix parameters, and spits out the resulting image.

Matrix parameters

  • w=200: Resizes the image to be 200px wide
  • r=180: Rotates the image 90 degrees clockwise (90, 180, and 270 are the available rotation angles)
  • c=130,60,200,300: Crops the image 130px from the left, 60px from the top, with a width of 200px and a height of 300px.

PhotoProvider

PhotoResource's contructor takes an instance of PhotoProvider, which is responsible for finding the image based on the name it's given and returning an InputStream that will yield its contents. This will most often mean looking up a file in a blob store (e.g. S3 or a file system).

An example that fetches the the avatar for the named Twitter user:

public class TwitterPhotoProvider implements PhotoProvider {
    @Override
    public InputStream getPhotoInputStream(String path) throws IOException {
        return new URL("https://api.twitter.com/1/users/profile_image?size=original&screen_name=" + path).openStream();
    }
}
com.thousandmemories.photon

1000Memories

Версии библиотеки

Версия
0.1.0