Download the PHP package mothership-ec/cog-imageresize without Composer

On this page you can find all versions of the php package mothership-ec/cog-imageresize. 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?

Informations about the package cog-imageresize

Image Resize

Resize Class and Controller

The Resizer can be accessed using the service image.resize:

$this->get('image.resize')->resize($url);

The Resize-class has two important methods:

This means, when we have an image called test.jpg, which is saved in cog:://public/files, this is how we could resize it:

$resizer = $this->get('image.resize');
$url = $resizer->generateUrl('/files/test.jpg', null, 400); // you can leave out either height or width!
$resizedImg = $resizer->resize($url);

We go the way of generating the url because that allows us to controll the behaviour with a controller: When we want to render a resized image in a view, we can pass in the generated $url as src-attribute. What will happen is, the first time the image is requested, the router will call the image resize controller, which will resize the image, save it to the new destination and return the image. After that the image already exists and can requested as any other image.

This is handy especially when used together with the twig extension.

Twig Extension

There are two methods which allow us to access the generateUrl()-method the ImageResize\Resize-class provides:

Default Image

If the $url passed to the resize-method is not the path to an existing file in the system, a default-image is resized instead.

This default image can be configured in config/app.yml:

image-resize:
    default-image-path: cogules/MyApp:SetUp/images/default.png

The generateUrl method looks up the file and if it doesn't exist it returns the url to the default image. That way only one image for each size is generated and the correct resized image can be generated as soon as a file is uploaded to the server.


All versions of cog-imageresize with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
mothership-ec/cog Version ~4.0
imagine/imagine Version ~0.4
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 mothership-ec/cog-imageresize contains the following files

Loading the files please wait ....