Skip to content

gayanSandamal/easy-php-image-resizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

php-image-resizer with aspect ratio

A simple mathematical approach to resize images (php 5.3 or above)

  1. Download "php-image-resizer.php" and copy it into your image directory. example 1 - uploads/php-image-resizer.php example 2 - images/php-image-resizer.php

  2. Give the image file name that you want to resize. Line #3 Step 1. if your image file name is "sample-image-jpg". Step 2. $source_url = "sample-image.jpg";

    Or you can execute this php file once the image is uploaded.

    Step 1. Use a any query to get the image file name.

    Step 2. Assign image name variable to $source_url variable in line #3 example - $source_url = $img_path;

  3. Define an image quality. The quality range is from 1 to 100. check line #11. example - $quality = 10;

  4. Define the width that you want as the final output of the image. Line #19. example - $after_width = 250;

    • No need to specify a unit such as px(Pixels). It will automatically get the value in pixels.
  5. It will check the width of input image is larger than the defined output width and will do the for you.

    ENJOY! ;-)

About

A simple mathematical approach to resize images(php 5.3+)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages