We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin tags within plugin tags

Development and Programming

daytonp's avatar
daytonp
1 posts
16 years ago
daytonp's avatar daytonp

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.

       
ender's avatar
ender
1,644 posts
16 years ago
ender's avatar ender

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}"}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.