Created
September 24, 2017 00:22
-
-
Save dustinwalker/e63fda927a97efc2b6da9e44c164beaf to your computer and use it in GitHub Desktop.
testing.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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