Download the PHP package smichaelsen/melon-images without Composer

On this page you can find all versions of the php package smichaelsen/melon-images. 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 melon-images

Melon Images

Responsive Image Management for TYPO3

This package uses the powerful responsive image cropping capabilities of TYPO3 and provides easy frontend rendering.

TYPO3 comes with the powerful feature of cropVariants, which lets you define use cases for your image including allowedAspectRatios and optionally coverAreas. This package simplifies the configuration and frontend rendering of this feature.

Configuration:

Files

You can write configuration in YAML, JSON or as PHP arrays. All examples below are in YAML, just use the same structure in JSON and in PHP.

From all loaded packages if any of the following configuration files exist, they will automatically be loaded:

Structure

The example below configures 4 variants of the tx_news_domain_model_news.fal_media field, that are detail, featured, teaser and square. The use case is we want to use the same image in different views with different cropping. Each variant can also have different sizes. The detail variant for example is available in the sizes big (for tablet and desktop viewport sizes) and phone.

See "Configuration Reference" bellow for a more detailed explanation

View the configuration

Beginning with TYPO3 v11 you can view your Melon Images configuration in the Configuration module.

Rendering

Auto Render

To render the responsive image with the correct cropping use the ResponsivePictureViewHelper:

The rendering (with the above config) looks something like this:

Custom markup

The rendering as responsive <picture> tag is not always desirable. You can also get the data of the sources and fallback image and use it in your own markup:

The rendering looks something like this:

ViewHelper Reference

\Smichaelsen\MelonImages\ViewHelpers\ResponsivePictureViewHelper

Arguments:

Configuration Reference

1. Breakpoints

breakpoints

Array of breakpoint names you can arbitrarily choose. Reference their names in the Size Configuration to indicate which is image size is intended for which breakpoint.

1.1 Breakpoint range

breakpoints.<breakpointName>

from (optional): The lower end of the breakpoint range in pixels.
to (optional): Indicates the upper end of the breakpoint range in pixels.

The breakpoint range is used for a media query in the responsive picture rendering in the frontend. Make sure your breakpoint ranges follow each other without gap or overlapping to ensure correct frontend rendering.

Example:

2. Pixel Densities

pixelDensities

Array or comma separated list of pixel densities that are rendered in the responsive picture elements. If you don't know what values you should put here 1,2 is good choice. It renders images in standard size (1) and double size for displays that support double pixel density (2).

Example:

3. Progressive Image File Formats

imageFileFormats

By default TYPO3 will automatically choose broadly supported file formats like jpg or png, depending on the source image. You can override this behavior by specifying a list of file formats that should be used for progressive image rendering.

Example:

This will add <source> elements to the responsive picture element with the webp file formats. As well as the default file format. You can also omit the default file format:

The fallback image will always be rendered in the _default file format to support legacy browsers.

Make sure you add the desired file extensions to $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'].

4. Per Table and Type Configuration

croppingConfiguration.<table>.<recordType>

If the configuration should apply to all records of the <table> regardless of the <recordType>, use _all as record type.

Example:

5. Per Field Configuration

croppingConfiguration.<table>.<recordType>.<fieldName>

The field must be:

  1. Either a FAL field (i.e. an inline type field holding sys_file_reference records)

or

  1. A field of the type inline, select or group referencing other records (See 7. Inline Records)

6. Variants

croppingConfiguration.<table>.<recordType>.<fieldName>.variants

Array of variant names you can arbitrarily choose. Think of a variant as of situations you want to use an image in. If want to use it in a list view, a detail view and a social media sharing format, your structure could look like in this example:

Reuse the variant name in the variant attribute of the melon:responsivePicture ViewHelper.

6.1 Variant Configuration

croppingConfiguration.<table>.<recordType>.<fieldName>.variants.<variantName>

title (optional): Title of the variant that is shown to the backend user. Per default the variant name (with the first letter uppercased) is used.

7. Sizes

croppingConfiguration.<table>.<recordType>.<fieldName>.variants.<variantName>.sizes

Array of size names you can arbitrarily choose. Here you define how many different sizes you need of your image in the given variant. Imagine you need to render the detail image of an article in 3 different sizes, but the list image only in one size because a responsive grid in the frontend takes care of the images always being displayed in the same size on all devices, your structure could look like in this example:

7.1 Size Configuration

croppingConfiguration.<table>.<recordType>.<fieldName>.variants.<variantName>.sizes.<sizeName>

breakpoints (optional): Comma separated list of breakpoint names (See 1. Breakpoints) that this size is used for. If omitted the size will have no media query condition is used on all screens - recommended if you use only one size for the given variant.
width (optional): Width in pixels the image is rendered in.
height (optional): Height in pixels the image is rendered in.
ratio (optional): If the ratio is given (in the x/y, e.g. 16/9) the width or the height may be omitted. The height can be calculated by width and ratio. The width can be calculated by height and ratio. It is also possible to specify a ratio as free, which configures the cropping editor to allow croppings with arbitrary image dimensions. If multiple sizes share the same ratios they are grouped in the backend so that the editor sets a single cropping for them. In the frontend they are still rendered as different sizes for different breakpoints.

If you provide width and height it results in a fixed aspect ratio that is enforced in the backend cropping tool. Neat!

7.1.1 Cover Areas

croppingConfiguration.<table>.<recordType>.<fieldName>.variants.<variantName>.sizes.<sizeName>.coverAreas

Array of cover areas. See the TCA Reference for details on that feature.

Each cover area needs has following properties:

x: Horizontal position of the upper left corner of the cover area from 0 to 1 (0 is the left, 1 the right edge of the image)
y: Vertical Position of the upper left corner of the cover area from 0 to 1 (0 is the top, 1 the bottom edge of the image)
width Width of the cover area from 0 to 1 (1 being 100% of the image width)
height Height of the cover area from 0 to 1 (1 being 100% of the image height)

Example:

7.1.2 Focus Area

croppingConfiguration.<table>.<recordType>.<fieldName>.variants.<variantName>.sizes.<sizeName>.focusArea

See the TCA Reference for details on that feature.

x: Horizontal position of the upper left corner of the initial focus area from 0 to 1 (0 is the left, 1 the right edge of the image)
y: Vertical Position of the upper left corner of the initial focus area from 0 to 1 (0 is the top, 1 the bottom edge of the image)
width Width of the initial focus area from 0 to 1 (1 being 100% of the image width)
height Height of the initial focus area from 0 to 1 (1 being 100% of the image height)

The position and dimensions of the focus area can be adjusted by the editor in the backend to mark the crucial area of the image.

Setting a focus area will have no effect on the backend image processing or its rendering with the melon:responsivePicture ViewHelper. If you want to use this feature you need to take care of the frontend implementation.

Example:

8. Inline Records (Nested Records)

croppingConfiguration.<table>.<recordType>.<fieldName>.<subType>.<subField>

If your field references other records that have image fields in them you can use this structure to configure.

Example: You have a "Contacts" content element, which a field field, that holds an arbitrary number of contact records. Each contact has a square photo.

You can nest this configuration as deep as you need it to be.

Power user hints

If you use YAML anchors to reuse certain configuration snippets, prefix them with __. This way they will only be available during YAML parsing and will automatically be stripped afterwards in the parsed configuration.

Breaking Changes

From 2.x to 3.x

Configuration in TypoScript is not possible anymore. Just convert it to YAML, the same scheme is still supported.

From 1.x to 2.x

If you're using custom markup to output your image the width and height are now enclosed in a \Smichaelsen\MelonImages\Domain\Dto\Dimensions object. In practice this means you will have to change fallbackImageData.width to fallbackImageData.dimensions.width.

From 0.8 to 0.9

With upgrading you will lose all cropping information. You need to crop the images again the backend.


All versions of melon-images with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.0
typo3/cms-core Version ^11.5 || ^12.0
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 smichaelsen/melon-images contains the following files

Loading the files please wait ....