Download the PHP package lordelph/icofileloader without Composer

On this page you can find all versions of the php package lordelph/icofileloader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
lordelph/icofileloader
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package icofileloader

Elphin IcoFileLoader

Build Status Coverage Status Quality Score

This package provides a means to load and convert .ico files in a PHP application. It has no dependencies apart from gd for rendering.

The package has unit tests which verify support for 1bit, 4bit, 8bit, 24bit and 32bit .ico files, and the newer form of .ico files which can included embedded PNG files.

Installation

For recent php versions (8.*) IcoFileLoader is available via Composer:

PHP 5.6 - 7.x

Earlier versions of php from 5.6 onwards can use version 2 of IcoFileLoader

PHP 5.4 - 5.5

If you need to use php5.4 or php5.5, you must install the v1.* branch

Usage

The IcoFileService class provides a one-shot method extractIcon. This should suit most use-cases where you simply want to get one image out of a .ico file.

It returns an image resource, which you can further manipulate with GD functions, e.g. save it to a file with imagepng

For example, here's how you extract a 32x32 transparent image from an ico file:

Render with background color

Instead of retaining the alpha channel from the icon, you can render with a background color instead - pass the required color as a renderer option as follows:

Extract icon at any size

The extractIcon method will try find an image in the icon which is the exact size you request at highest color depth it can find. If it can't, it will resize the best quality image in the icon. So, you can request any size you require...

Extract icon from a URL

As long you have the PHP fopen wrappers installed, you can pass a URL to extractIcon

Extract icon from binary data

If you already have an ico file held as a binary string, extractIcon will cope with that just fine too:

Lower level methods

If you want to do more than just extract a single image from an icon, you can use lower level methods of IcoFileService to inspect an .ico file and perform multiple renderings.

The fromFile, fromString and from methods will parse an ico file and return an Icon instance representing an icon and the images it contains.

You can iterate the images in icon, examine them, and render them with renderImage

For example, here's how you could extract all the images in an icon and save them as individual files.

Internals

The service is composed of a parser and a renderer, which can be injected into the service at runtime if you wanted to override them.

The current GdRenderer works by drawing individual pixels for BMP based icon images. This isn't going to be terribly fast. PHP 7.2 will have support for BMP images, and I'll add a renderer which takes advantage of that when it is released.

Testing

Contributing

Please see CONTRIBUTING for details.

Credits

Thanks also to the PHP League's skeleton project from which this project's structure was derived.

License

The MIT License (MIT). Please see License File for more information.

Note: this was based on some classes originally written in 2005 by Diogo Resende. While these were originally provided on the PHPClasses site under a GPL license, Diogo kindly agreed to allow them to be licensed under an MIT license.


All versions of icofileloader with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.0
ext-gd Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lordelph/icofileloader contains the following files

Loading the files please wait ....