How to change image size pulled from ShortcodeCarousel plugin?

I noticed that the ShortcodeCarousel plugin pulls the “square_thumbnail” as a default. I’d like to set an option, available through the shortcode, that lets users opt to pull other item types (original, fullsize, thumbnail, square_thumbnail). I am able to get the plugin to pull only fullsize or only square_thumbnails, but am struggling with how to introduce the choice. Here’s what I have so far:

In ShortcodeCarouselPlugin.php I’ve added:

if (isset($args['image_type'])) { $params['image_type'] = $args['image_type']; }
I think I probably also need to set something in the configs area, but everything I’ve tried has broken the page or not had any effect.

In carousel.php I’ve added:

`<?php if(isset($args['carousel']['image_type'])) {

                $image_type = $args['image_type'];

                echo link_to_item(
                item_image($image_type, array(), 0, $item),
                array('class' => 'shortcode-carousel-image'), 'show', $item 
                );  
            }
            else {
                echo link_to_item(
                item_image('square_thumbnail', array(), 0, $item),
                array('class' => 'shortcode-carousel-image'), 'show', $item 
                );  
            }
        ?>`

In my index.php file (since this will appear on my home page), I’ve added:

<?php echo $this->shortcodes('[featured_carousel showtitles=true speed=slow image_type=fullsize]'); ?>

Basically, I want to be able to pass the value of “image_type” into the place in carousel.php that currently has ‘square_thumbnail’ as a static option. But I don’t quite get how to access those values (let alone validate them!). Any pointers would be greatly appreciated! I’m still getting my feet wet with PHP.

I’m guessing it’s a thing that similar variable names are used in very different ways. in ShortCodeCarouselPlugin.php, $params is the params used to search for the items, so it won’t care about the derivative type.

You’re right that $configs is where you want to put your image type data – that’s what gets passed along to carousel.php.

So, in the plugin file, yep, put your image type data into the $configs array.

Then, in carousel.php, the variable to look in isn’t $args (it won’t exist in that file), it’s $configs:

$image_type = $configs['image_type'];

and

isset($configs['carousel']['image_type'])

except that the keys need to be sorted out so they’re the same – that’ll just depend on how you add that in to the $configs array in ShortCodeCarouselPlugin.php

Thanks! I finally got this to pull in correctly using your tips!