$dimension->fitWidthAndHeight()

Fits the width and height by the given values and returns a modified dimension object

  • return ($image;)

Example

<?php

$image = $page->image();
$image->dimensions()->fitWidthAndHeight(300, 200);

echo html::tag('img', array(
  'src'    => $image->url(),
  'width'  => $image->width(),
  'height' => $image->height()
));

?>