Skip to content

Instantly share code, notes, and snippets.

@tim-bec
Last active December 22, 2015 01:58
Show Gist options
  • Save tim-bec/6399626 to your computer and use it in GitHub Desktop.
Save tim-bec/6399626 to your computer and use it in GitHub Desktop.
Contao Image-Prozessing for responsive images
<?php
$this->import('Environment');
$ua = $this->Environment->agent; // Import User Agent class
// check if agent is mobile
if($ua->mobile) {
$image_link = $arrItem['raw']['picture']; // load picture url
$image = $this->getImage($image_link,1024,768,'proportional'); // create thumb $link, $w,$h,$cropmode
}
// if not, deliver the full picture
else {
$image = $arrItem['raw']['picture'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment