I’m trying to get imgix to work and am getting the following error. I read this post but I’m not sure how best to solve the problem.
<?php foreach($piece->thumbnails()->yaml() as $image): ?>
<?php if($image = $piece->image($image)): ?>
<a href="<?= $image->url(); ?>" data-fancybox="gallery" data-slug="<?php echo str::slug($piece->title())?>" data-caption="<?= $piece->title()->html(); ?>">
<img src="<?php echo imgix($image, url()) ?>" />
</a>
<?php endif ?>
<?php endforeach; ?>
and this is the plugin code
<?php
function imgix($url, $params = array()) {
if(is_object($url)) {
$url = $url->url();
}
$url = trim(str_replace(array(url(), 'http://sugarandspice.pink'), '', $url), '/');
$url = 'https://sugarandspice.imgix.net/' . $url . '?' . http_build_query($params);
return $url;
}