Download the PHP package waughj/html-picture without Composer

On this page you can find all versions of the php package waughj/html-picture. 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 html-picture

HTML Picture

Class for easy generation o' picture tag HTML code.

Use

Arguments for constructor:

  1. Fallback image as HTMLImage object.
  2. Sources as array o' HTMLPictureSource objects.
  3. Array o' picture element attributes.

A simpler way to generate these is to use the "generate" static method, which takes the following arguments:

  1. String representing base local filename ( don't include extension ).
  2. String representing extension ( don't include "."" ).
  3. Hash map with optional arguments:
    1. "loader": file loader to help set URL directory in which 1st argument will be treated local to & the server directory for getting the modified date o' the file to break cache corruption. See https://github.com/waughjai/file-loader for mo' info on how to use this. Can be hash map or FileLoader object.
    2. "img-attributes": HTML attributes that will go in the img tag ( these will affect the image that is shown ).
    3. "picture-attributes": HTML attributes that will go in containing picture tag.
    4. "source-attributes": HTML attributes that will go in every source tag. You probably won't need this. Don't use ID, as it will create multiple IDs, which is invalid.

Example

use WaughJ\HTMLPicture\HTMLPicture;

echo HTMLPicture::generate
(
    'photo',
    'jpg',
    '480w 320h, 800w 600h, 1200w 800h',
    [
        'loader' =>
        [
            'directory-url' => 'https://mywebsite.com',
            'directory-server' => getcwd(),
            'shared-directory' => 'tests'
        ],
        'img-attributes' => [ 'class' => 'center-img' ],
        'picture-attributes' => [ 'id' => 'slider-42' ],
        'source-attributes' => [ 'class' => 'source-item' ]
    ]
);

Will print ( #s after "?m=" will vary ):

<picture id="slider-42"><source class="source-item" srcset="https://mywebsite.com/tests/photo-480x320.jpg?m=1543530332" media="(max-width:480px)"><source class="source-item" srcset="https://mywebsite.com/tests/photo-800x600.jpg?m=1543530717" media="(max-width:800px)"><source class="source-item" srcset="https://mywebsite.com/tests/photo-1200x800.jpg?m=1543530725"><img src="https://mywebsite.com/tests/photo-480x320.jpg?m=1543530332" class="center-img" alt="" /></picture>

Error Handling

PictureHTML's default o' adding a version to each URL may throw a WaughJ\FileLoader\MissingFileException exception when using the static generate method ( but not the regular constructor, which doesn't set any URLs ). This exception contains a fallback version o' the PictureHTML that is equivalent to a version with "show_version" turned off.

Example:

$picture = null;
try
{
    $picture = HTMLPicture::generate
    (
        'iainthere',
        'jpg',
        [
            [ 'w' => 480, 'h' => '320' ],
            [ 'w' => 800, 'h' => 600 ],
            [ 'w' => '1200', 'h' => 800 ]
        ],
        [
            'loader' => [ 'directory-url' => 'https://mywebsite.com', 'directory-server' => getcwd(), 'shared-directory' => 'tests' ]
        ]
    );
}
catch ( MissingFileException $e )
{
    $picture = $e->getFallbackContent();
}

Changelog

0.7.0

0.6.0

0.5.0

0.4.0

0.3.0

0.2.0

0.1.0


All versions of html-picture with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
waughj/html-image Version >=0.9.2
waughj/verified-arguments-same-type Version *
waughj/html-attribute-list Version *
waughj/file-loader Version >=0.5.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 waughj/html-picture contains the following files

Loading the files please wait ....