solved Can I Add Image Size To Embed Code?

derrickhand300
@derrickhand300
10 years ago
1,353 posts
Is it possible to add Image display size to this embed code?
{jrCore_list module="jrProfile" order_by="_item_id desc" search1="profile_active = 1" pagebreak="36" page=$_post.p pager=true}

I am looking for a way to add something like this
item_id=$item._user_id size="small"

updated by @derrickhand300: 12/22/16 11:55:59AM
derrickhand300
@derrickhand300
10 years ago
1,353 posts
The reason I am finally asking this question is that i have so many templates made for different image size layouts that I am getting lost on what goes to what...So I am hoping their is a way to add "image size" in the embed code of each without having to create a new template and do the template=item_list_small.tpl stuff
paul
@paul
10 years ago
4,335 posts
Yes - You can add a custom parameter to the jrCore_list call and it will be available in the template as part of the $_params array.
So, adding something like -

my_image_size="small"

to the jrCore_list call, then in the template, smarty variable $_params.my_image_size = "small"
hth


--
Paul Asher - JR Developer and System Import Specialist
derrickhand300
@derrickhand300
10 years ago
1,353 posts
Thanks Paul- I'm going to have to study this a bit-I was hoping it would be something I could add to the embed code without having to get into the templates-creating a jrCore _list_call is going to be new territory for me
michael
@michael
10 years ago
7,822 posts
What you have there in your {jrCore_list call is a request to get some stuff. in your call there is no template="some_template.tpl" parameter, so by leaving that out you are saying "Just format it in the default way".

If you want to format it differently, use the template="" parameter. Then in that template you can format it any way you like.

The normal way would be to copy the code from the module and use that as the template.

Eg for your code above you have
{jrCore_list module="jrProfile" order_by="_item_id desc" search1="profile_active = 1" pagebreak="36" page=$_post.p pager=true}

To use the jrProfile's item_list.tpl in there, but tweak it a bit, you can either put that in a template file in your skin and give it a name, or you can use the smarty 'capture' feature to avoid needing to have another .tpl file in your skin. Either works.

Using a capture, it would look like this:
{capture name="row_template" assign="template"}
{literal}
{if isset($_items)}

    {foreach from=$_items item="item"}
    <div class="item">

        <div class="container">
            <div class="row">
                <div class="col2">
                    <div class="block_image">
                        <a href="{$jamroom_url}/{$item.profile_url}">{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_image" item_id=$item._profile_id size="large" crop="auto" class="iloutline img_scale" alt=$item.profile_name title=$item.profile_name width=false height=false}</a>
                    </div>
                </div>
                <div class="col10 last">
                    <div class="p10">
                        <h1><a href="{$jamroom_url}/{$item.profile_url}">{$item.profile_name}</a></h1>
                        {if !empty($item.profile_bio)}
                        <br><span class="normal">{$item.profile_bio|jrCore_format_string:$item.profile_quota_id|truncate:250:"..."}</span>
                        {/if}
                    </div>
                </div>
            </div>
        </div>

    </div>
    {/foreach}
{/if}

{/literal}
{/capture}

{jrCore_list module="jrProfile" order_by="_item_id desc" search1="profile_active = 1" pagebreak="36" page=$_post.p pager=true template=$template}

That part in the capture was taken from the latest version of:
/modules/jrProfile/templates/item_list.tpl

Adjust it however you like to only alter how that particular jrCore_list is formatted.
derrickhand300
@derrickhand300
10 years ago
1,353 posts
Thanks Michael-I was just hoping there was a way to change the image display size in the embed code that is using the standard template-Instead of having to make a new template
I am going to need to learn he smarty 'capture' feature and learn to edit the smarty code at some point
michael
@michael
10 years ago
7,822 posts
That code above is what you want. Put that anywhere, but change the size="large" to size="small" (or whatever other size you like)

Valid sizes are:
24,xxsmall,40,xsmall,56,72,small,96,icon96,128,icon,196,medium,256,large,320,larger,384,xlarge,512,xxlarge,800,xxxlarge,1280

There is nothing built in to the default template to change the size. Another way to do it would be to change the default template to

size=$my_image_size

and use the code paul gave above to get $_params.my_image_size but then you would need to check that that comes out as well, so its a bit more complicated to do it for the default templates.

Need to add this to the default template up top, to make sure its there.
{if isset($_params.my_image_size)}
{$my_image_size = $_params.my_image_size}
{else}
{$my_image_size = "large"}
{/if}

updated by @michael: 02/24/15 11:33:29AM

Tags