Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.
/ resizer Public archive

Resize images and create high-resolution 2x images for use with picturefill / scrset.

Notifications You must be signed in to change notification settings

jeremytubbs/resizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Resizer

Resize and create high-resolution images for use with picturefill scrset. Does not support cropping.

Example implementation -

    // Set sizes array
    $sizes = [
        'thumb'   => [165, null],
        'preview' => [360, 420]
    ];

    // Setup resizer - path and sizes are required
    $resizer = Jeremytubbs\Resizer\ResizeFactory::create([
        'path'    => 'images',  // Export path for images
        'driver'  => 'imagick', // Choose between gd and imagick support the default is gd
        'format'  => 'png',     // Default is jpg
        'sizes'   => $sizes,    // Array of image sizes
        'image2x' => false      // Default is true
    ]);

    $resizer->makeImages(
        'images/KISS.jpg',        // Path to source image
        'new/location',           // Destination Path
        'keep-it-simple-stupid'); // Rename image

Example response -

{
  status: "ok",
  output: {
    data: {
      thumb: "keep-it-simple-stupid_thumb.png",
      preview: "keep-it-simple-stupid_preview.png",
      thumb_2x: "keep-it-simple-stupid_thumb_2x.png",
      preview_2x: "keep-it-simple-stupid_preview_2x.png"
    },
    source: "source/file/path"
  },
  message: "Everything is okay!"
}

Supported Image Libraries

  • GD Library (>=2.0)
  • Imagick PHP extension (>=6.5.7)

About

Resize images and create high-resolution 2x images for use with picturefill / scrset.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages