PHP Classes

morgen: Generate icon images for multiple platforms

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStarStar 80%Total: 230 All time: 8,157 This week: 206Up
Version License PHP version Categories
morgen 0.3MIT/X Consortium ...5.3PHP 5, Graphics
Description 

Author

This class can generate icons for multiple types of platforms.

It can take a XML configuration file with definitions of sizes and platforms that your Web application needs icons and images.

The class looks up another XML file that defines which types and sizes of images are necessary for each of the requested platforms that are supported.

Currently the configuration defines types and sizes of images for Android, iOS and Web platforms.

It can generate resized versions of the images in JPEG, PNG, GIF and SVG source files.

Innovation Award
PHP Programming Innovation award nominee
September 2016
Number 7


Prize: SourceGuarding PHP encoder tool
Developers that have tried to create applications that should run both on the Web, Android and iOS devices know that you need to have a different sets of application image icons that looks well on different resolutions.

This package provides a solution by automatically generating icon sets for different devices and sizes.

It supports generating icons from a SVG source graphics if you can run a program like Inkscape to convert images from SVG to the PNG format.

Manuel Lemos
Picture of Alexander Selifonov
  Performance   Level  
Name: Alexander Selifonov is available for providing paid consulting. Contact Alexander Selifonov .
Classes: 20 packages by
Country: Russian Federation Russian Federation
Age: 62
All time rank: 502 in Russian Federation Russian Federation
Week rank: 51 Down3 in Russian Federation Russian Federation Down
Innovation award
Innovation award
Nominee: 16x

Winner: 2x

Example

<?php
/**
* @name morgen-demo.php
* Demonstrating functionality of morgen.php
* @author Alexander Selifonov
*/


include_once('../src/morgen.php');

$generator = new \Morgen\IconGenerator();
$generator->setSvgConvertor('D:/app/inkscape/inkscape.exe -z {from} -e {to}');

$options = array(
 
'project' => 'project-greatApp.xml',
 
'forced' => true
);

$generator->createIconsFromImages($options);


Details

Morgen - Mobile Resource Generating

Short description

Android and iOS developers know that designing one icon set for their application is not enough: because of many device types and screen sizes they have to create resized pictire collections for many "resolutions". These sets should be placed in "resources" subfolders according to device types/display resolutions.

Android Studio has a special tools for dealing with them (Android media tools), some people use Photoshop/Illustrator scripts that automate creating icon sets for all resolutions. And there are a many other tools for that.

Here is a PHP solution. It can make resized versions for JPG, PNG, GIF source files.

If you have installed some SVG-to-PNG converter program (inkscape for example) that can work with command line parameters, Morgen can convert SVG files too (resized versions will be of PNG type).

Simple Using example

include_once('../src/morgen.php');

$generator = new \Morgen\IconGenerator();

// show full cmd line for your inkscape installation:
$generator->setSvgConvertor('D:/inkscape/inkscape.exe -z {from} -e {to}');

$options = array(
  'project' => 'project-greatApp.xml',
  'forced'  => false
);

$generator->createIconsFromImages($options);

Morgen can create all icon sets from a single media pack for all defined projects: for android version, for ios version, for web application etc. All you need is defining all "application types" in XML configuration file.

You will find default configuration file morgen.cfg.xml, that contains three "predefined" profiles (application types) for generated pictures: "android", "ios" and "webapp" (webapp is just a sample).

To change them or add your own ones, edit the global parameters in morgen.cfg.xml - it should be placed in the same folder with morgen.php module.

And you have to create definition XML file for each project, where you can choose desired application types, destination folders, used devices types, and selected files.

See a wiki for using details.

License

Distributed under MIT License MIT


  Files folder image Files (9)  
File Role Description
Files folder imagedemo (2 files, 1 directory)
Files folder imagesrc (2 files)
Accessible without login Plain text file LICENSE Lic. license
Accessible without login Plain text file README.md Doc. Readme

  Files folder image Files (9)  /  demo  
File Role Description
Files folder imagemedia (3 files)
  Accessible without login Plain text file morgen-demo.php Example demo script
  Accessible without login Plain text file project-greatApp.xml Data Project definition example

  Files folder image Files (9)  /  demo  /  media  
File Role Description
  Accessible without login Image file button-001.jpg Icon source image sample
  Accessible without login Plain text file morgen.svg Data source image sample
  Accessible without login Image file robot.png Data source image sample

  Files folder image Files (9)  /  src  
File Role Description
  Accessible without login Plain text file morgen.cfg.xml Data Main configuration file
  Plain text file morgen.php Class Main class module

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:230
This week:0
All time:8,157
This week:206Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:100%StarStarStarStarStarStar
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:80%StarStarStarStarStar
Rank:19