Hello, I’ve made a plugin for my companies website to read field with a list of images in it and output each image separately.
I would like to have the image resized by using imgsizer but I am not sure how to pass the url to it.
This is my template code which doesn’t seem to work.
{exp:portfolio_images entry_id="{entry_id}"}
<div class="eachpost twocols">
<div class="inner">
{exp:imgsizer:size image="{image}" width="450" }
</div>
</div>
{/exp:portfolio_images}And my plugin code
class Portfolio_images {
var $return_data = "";
function Portfolio_images()
{
global $TMPL, $DB;
$entry_id = $TMPL->fetch_param('entry_id');
$tag_data = $TMPL->tagdata;
$query = $DB->query("SELECT field_id_13
FROM exp_weblog_data
WHERE entry_id = '$entry_id'");
$images = $query->row['field_id_13'];
$images = preg_split('/\n/',$images);
foreach($images as $value)
{
if(strpos($tag_data, '{image}')){
$this->return_data .= $TMPL->swap_var_single('image', $value, $tag_data);
}
else
{
$this->return_data .= $tag_data;
}
}
return($this->return_data);
}
}Is there a way I can get this to work?
Any other suggestions not relating to this specific problem are also appreciated.
had the same problem with imgsizer and one of my own plugins.
Just use an embedded template to call imgsizer:
{exp:your_plugin}
{embed="includes/imgsizer" src="{image}" width="100" alt="{title}" quality="100"}
{/exp:your_plugin}includes/imgsizer.php:
{exp:imgsizer:size src="{embed:src}" width="{embed:width}" height="{embed:height}" alt="{embed:alt}" quality="{embed:quality}"}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.