PHP code example of jouwweb / reverse-image-cover
1. Go to this page and download the library: Download jouwweb/reverse-image-cover library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jouwweb / reverse-image-cover example snippets
$viewport = new BackgroundCoverViewport(
$viewportWidth,
$viewportHeigt,
$backgroundPositionX,
$backgroundPositionY
);
$crop = $viewport->computeUsedCrop(
$imageWidth,
$imageHeight
);
echo "Visible part of image starts at({$crop[0]}, {$crop[1]}) ";
echo "and has a dimension of {$crop[2]} x {$crop[3]}";