Skip to content

Instantly share code, notes, and snippets.

@dustinwalker
Created September 24, 2017 00:22
Show Gist options
  • Save dustinwalker/e63fda927a97efc2b6da9e44c164beaf to your computer and use it in GitHub Desktop.
Save dustinwalker/e63fda927a97efc2b6da9e44c164beaf to your computer and use it in GitHub Desktop.
testing.php
<?php
/**
* area plugin for Craft CMS
*
* @author DW
* @copyright Copyright (c) 2017 DW
* @link www.url.com
* @package Area
* @since 1.0.0
*/
namespace Craft;
class AreaVariable
{
public function resize($input = null)
{
$thisImage = $input['asset'];
$ratio = $thisImage['width'] / $thisImage['height'];
$area = $input['area'];
$x = sqrt( ($area / $ratio) );
$resizeTo = array(
'width' => round($ratio * $x),
'height' => round($x * 1),
);
return $resizeTo;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment