ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Using Image Sizer plugin causes conditional statements to not execute

February 01, 2011 5:20am

Subscribe [3]
  • #1 / Feb 01, 2011 5:20am

    Varmaj

    7 posts

    Folks, I’m using the imgsizer plugin in an art web site I’m building. There is a channel called paintings for storing info about paintings. One of the fields (checkbox) is called “sold” with a value of ‘sold’ for paintings that are no longer available for sale.

    What I’m trying to do is to use a conditional statement like this:

    {if sold == "sold"}SOLD{/if}

    to display the word “sold” next to painting thumbnails of sold paintings.

    I’m using the imgsizer plugin to generate 100x100px thumbnails of all the painting images. But when I do that, the conditional statement I’ve used above simply doesn’t work. It produces no error; just a blank. Very weird.

    So this code works fine:

    {title}
    
    Medium: {painting_medium}
    
    Size: {painting_size}
    
    {if sold == "sold"}SOLD{/if}
    

    But when I toss in the imgsizer tag like this:

    {exp:imgsizer:size src="{painting_pic}" width="100" height="100" alt="{title}"}
    {title}
    
    Medium: {painting_medium}
    
    Size: {painting_size}
    
    {if sold == "sold"}SOLD{/if}
    

    It doesn’t work. It shows the painting thumbnail, the title, medium, and size, but for sold paintings, it just produces blank output in the conditional statement.

    Any idea what could be causing this? I’ve tried using parse=“inward” in the tag but that doesn’t do it either.

  • #2 / Feb 01, 2011 10:27am

    Varmaj

    7 posts

    OK, an update. Tried to do the same thing using the EE 2.x.x ED Image Resizer Plugin. Same result. Image thumbnails show fine, but the conditional statement doesn’t do anything.

  • #3 / Feb 01, 2011 11:35pm

    Varmaj

    7 posts

    Some more testing has revealed that {if} conditions even earlier in the template are failing when the plugin statement remains in the template.

    However, I found a hack solution to the problem. I installed the SwitchEE plugin and used the following code:

    {exp:switchee variable = "{sold}" parse="inward"}
        
        {case value="sold"}
            <span class="sold">sold</span>
    
        {/case}
      
    {/exp:switchee}

    This works just fine. Weird, huh? Does that help anyone trace the root of the problem? Something is causing a break in the parsing.

  • #4 / Feb 02, 2011 4:05pm

    Ingmar

    29245 posts

    This only happens with ImgSizer? I.e., it works as expected once you remove any reference to it?

  • #5 / Feb 02, 2011 4:53pm

    Varmaj

    7 posts

    Yes, it works once I remove the reference to the plugin.

    So I wondered if it was only ImgSizer or plugins in general causing the issue. Which is why I downloaded another plugin, “ED Image Resizer” (as I posted in my update) to do the same function.

    I got the same result. So it’s not specific to the ImgSizer plugin then. Weird, eh?

  • #6 / Feb 03, 2011 8:05am

    Sue Crocker

    26054 posts

    At least you have a workaround… so closing the thread. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases