Giter VIP home page Giter VIP logo

gimage's Introduction

GImage

Build Status Latest Unstable Version Total Downloads License

A PHP library for easy image handling. ๐Ÿ–ผ

GImage is a simple and small library based on PHP Image Processing and GD for processing images easily.

A simple presentation card with GImage

Presentation card built with GImage - View code example

Features

  • Load an image from a local path, URL or image resource.
  • Create shapes such as rectangles or ellipses with opacity.
  • Resize, scale or crop images proportionally.
  • Rotate images, shapes or texts.
  • Embed text with custom TTF fonts.
  • Compose a pool of images with Canvas.
  • Swap image formats such as JPEG, PNG or GIF.
  • Save images locally or output them on the browser.
  • Save several copies of the same image.
  • Render an image in memory and return its resource.

Requirements

GImage requires PHP 7.4 or a recent PHP version with the latest GD Extension.

Install

composer require joseluisq/gimage

Usage

Load an external PNG image and save it as JPG:

<?php

use GImage\Image;

// PNG image (600x199)
$url = 'https://i.imgur.com/G5MR088.png';

$arch = new Image();
$arch
    // Load from URL
    ->load($url)
    // Scale to 50% (300x99)
    ->scale(0.5)
    // Change the format to JPG
    ->toJPG()
    // Saving in local path
    ->save('arch.jpg');

See GImage Website for detailed usage instructions and more advanced examples.

Changelog

Check out the CHANGELOG.md file.

Examples

See code examples directory.

Development

Run tests

Via Composer

composer install
composer run-script test

Via Docker (multi PHP versions test)

make docker-tests

Contribution

Feel free to send some Pull request or file an issue.

License

This work is primarily distributed under the terms of the MIT license.

ยฉ2015-present Jose Quintana

gimage's People

Contributors

franklee0902 avatar joseluisq avatar matiit avatar sunnyphp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gimage's Issues

New documentation v3.0

ToDo

https://joseluisq.github.io/gimage/

  • Introduction
  • Getting Started
  • Classes
    • Image
    • Figure
    • Text
    • Canvas
  • Examples
    • Cropping
    • Swapping formats
    • Resizing
    • Rotation
    • Creating figures
    • Text embedding
    • Composing with canvas
    • Render images in-memory
    • Creating a presentation card
  • API Documentation

Examples don't work.

  • Ellipse example - generates empty, transparent png file.
  • Rectangle example - generates empty, transparent png file.
  • Card example, text is missing on the image:
    image

My setup:
PHP 7.0.15, Linux.

Project opens for new maintainers

Due I don't have time to maintain this project. I'm opening this issue for people interested on it as maintainer.
If you would like to collaborate with this project, please let me to know here.

Load an image resource directly

Example:

use GImage\Image;

$resource = imagecreatefrompng('/large.png');

$img = new Image();
$img
  ->load($resource)
  ->scale(0.5)
  ->save('/thumbnail.png');

Refs: #28

Cloud uploading examples

It would be great if we can provide Cloud uploading examples using S3, Google Drive, Dropbox, etc.

Example with text array

Hi, I want generate a restaurant menu with front/verse. How I do array with menu items.

Thanks

Get the image resource without saving

Sometimes it necessary to render the image without saving. For example for upload it to Amazon S3 or some cloud provider.

GImage class has a render() method to render the image in memory. But it has private visibility.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.