Image Manipulation PHP Script - S3 Storage

Imagemagick based image manipulation php script to handle image resize and crop with different

Share on Social Media

Image Manipulation PHP Script - S3 Storage

Screenshots


Details


Image manipulation PHP script suits for modern ecommerce, creative and more websites to manipulate images with following features



  1. Resize and crop

  2. Watermarking

  3. Various image sizes and ratio

  4. Progressive JPEG

  5. Configurable image quality for each size

  6. Based on Queue Process


System Requirements:



  1. ubuntu 14.04

  2. ImageMagick-7.0.4

  3. Jpegtran 1.4.2

  4. PHP >= 5.4

  5. Supervisor

  6. Redis


Benefits:



  1. It handle loads because it's queue based background image manipulation

  2. Highly scalable

  3. Clean Code

  4. Watermarking and Positioning

Installation Instructions:



Installation ImageMagick:


  • sudo apt-get update
  • sudo apt-get install build-essential checkinstall libx11-dev libxext-dev zlib1g-dev libpng12-dev libjpeg-dev libfreetype6-dev libxml2-dev
  • sudo apt-get build-dep imagemagick
  • cd /tmp/
  • tar -xzvf ImageMagick-7.0.4-5.tar.gz
  • cd ImageMagick-7.0.4-5/
  • sudo ./configure
  • sudo checkinstall
  • sudo ldconfig /usr/local/lib

Jpeg tran for Progressive JPEG (Installation)


  • sudo apt-get install libjpeg-turbo-progs

Application Setup



  • Check out the code

  • Do composer install with following command

    composer install



  • Rename src/PckImageProcessor/Config/config.sample.php to config.php and update configuration of s3 and image sizes and if needed then give watermark image absolute path.


  • Then setup supervisor to watch deamon process example configuration as follows

    [program:image-worker] 
    process_name=%(programname)s%(process_num)02d
    command=php app.php image:process
    autostart=true
    autorestart=true
    user=www-data
    numprocs=5
    redirect_stderr=true
    stdout_logfile=/var/log/image-worker.log


  • it use redis as queue so that you must give credentials to config.php file

  • Whenever image has been uploaded then need to push the data to redis as follows
$redis->lPush('IMAGE-PROCESS', '{"filename": "purple_sunset-wallpaper-960x600.jpg", "folder":"image-processor-demo/sample"}');

  • Any help feel free to add support comment here.

Version History


v1.0

Released On: November 20, 2017


Reviews


Not yet reviewed

Question or Comment


No support questions or comments