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.

Displaying path to thumbnail generates PHP error

April 23, 2012 1:44pm

Subscribe [2]
  • #1 / Apr 23, 2012 1:44pm

    The Design Core

    359 posts

    I am using the following code to display auto-generated thumbnail images:

    {products-image}{path}_thumb/{filename}.{extension}{/products-image}

    It is generating the following PHP errors:

    A PHP Error was encountered
    Severity: Warning

    Message: array_merge() [function.array-merge]: Argument #1 is not an array

    Filename: libraries/Functions.php

    Line Number: 2585

    A PHP Error was encountered
    Severity: Warning

    Message: Cannot modify header information - headers already sent by (output started at /codeigniter/system/core/Exceptions.php:170)

    Filename: core/Common.php

    Line Number: 405

    Any help is appreciated.

  • #2 / Apr 23, 2012 2:06pm

    The Design Core

    359 posts

    So I figured out that it generates the error if an entry has no image. No error gets generated if all entries have images.

    But that makes no sense because when there is no image, it displays nothing since I have the code wrapped in an if statement like so:

    {if products-image}
        
            <a href="/{segment_1}/{segment_2}/&lt?php">; ?>/{url_title}"]_            {products-image}{path}_thumb/{filename}.{extension}{/products-image}_        </a>
        
    {/if}

    Any ideas why this may be happening?

  • #3 / Apr 24, 2012 11:27am

    Shane Eckert

    7174 posts

    Hi mediapimp,

    I am sorry to hear you are running into this problem.

    Are you sure that the logic does fail?

    Would you mind showing me the entire template code?

    Thanks,

  • #4 / Apr 24, 2012 1:01pm

    The Design Core

    359 posts

    The logic does work as the code block does not get written if there is no image.

    Here is the full template code:

    <body class="twocolumn">
    
    <div id="outer">
    
     {embed="includes/header"}
    
     {embed="includes/banner" subtitle="Looking out for you with a full range of CCTV products, an exceptional warranty and more features for the money."}
    
     <div id="main">
    
      <div class="nav" id="leftnav">
       
       {exp:cat_menu:render 
        base_url="/products" 
        max_depth="3" 
        channel="products"
        category_group="1" 
        nest_categories_in_url="yes" 
        include_entries="yes"
        entries_order_by="entry_date"
        entries_sort="desc"
       }
       
      </div><!-- /#leftnav -->
    
      <div class="article" id="content">
    
       <?php $cat = CategoryHelper::instance()->get_category_for_url_title('{segment_3}'); ?>
       <?php $parent_cat = CategoryHelper::instance()->get_category_for_url_title('{segment_2}'); ?>
          
        <h2><?php echo $cat['cat_name'] ?></h2>
    <p>   <br />
        <?php if (isset($cat['cat_description']) && !empty($cat['cat_description'])): ?><br />
         <?php echo $cat['cat_description'] ?><br />
        <?php endif; ?><br />
       <br />
       <br />
        {exp:channel:entries<br />
         channel="products"<br />
         disable="category_fields|member_data|pagination|trackbacks"<br />
         dynamic="off"<br />
         category="{embed:category_id}"<br />
         status="open|featured"<br />
        }</p>
    
    <p>    <div class="productitem {switch="floatleft|floatright"}"></p>
    
    <p>    </p><h6><?php echo $cat['cat_name'] ?></h6>
    <p>     <h3 class="h4"><a href="/{segment_1}/{segment_2}/&lt?php">; ?>/{url_title}" class="noline"]{title}</a></h3><br />
         {if products-image}<br />
         <br />
          <a href="/{segment_1}/{segment_2}/&lt?php">; ?>/{url_title}"]_       {products-image}{path}_thumb/{filename}.{extension}{/products-image}_      </a><br />
         <br />
         {/if}<br />
         <br />
          <?php echo substr(strip_tags('{products-subtitle}'), 0, 120) . '...'; ?></p>
    
    <p>      <a href="/{segment_1}/{segment_2}/&lt?php">; ?>/{url_title}" class="arrowlink"]Product Details</a><br />
        </div><!-- /.productitem --></p>
    
    <p>    {/exp:channel:entries}<br />
         <br />
       <a href="#">back to top</a><br />
       <br />
      </div><!-- /#content --></p>
    
    <p>  <div class="aside" id="sidebar"><br />
      </div><!-- /#sidebar --></p>
    
    <p> </div><!-- /#main --></p>
    
    <p></div><!-- /#outer -->

    The error does not get generated if I replace

    {products-image}{path}_thumb/{filename}.{extension}{/products-image}

    with

    {products-image}
  • #5 / Apr 25, 2012 5:44pm

    Shane Eckert

    7174 posts

    Hey MediaPimp,

    What version of ExpressionEngine are you currently running?

    I wonder if this is as simple as a missing “s”.

    Can you try

    {products-image}{path}_thumbs/{filename}.{extension}{/products-image}

    Thanks,
    Shane

  • #6 / Apr 25, 2012 5:52pm

    The Design Core

    359 posts

    I’m running the latest version & build of EE.

    The folder “_thumb” is not the auto-generated thumbs folder that I believe you are referring to. It is a custom folder created from the Image Manipulations in the File Manager prefs. I made the short name “thumb” so it created the folder “_thumb”.

  • #7 / Apr 26, 2012 4:28pm

    Shane Eckert

    7174 posts

    Hi mediapimp,

    I thought that was too easy.

    Are you using and Add-Ons that deal with images?

    For that matter, would you mind listing for me the Add-Ons that you have installed?

    Please let me know.

    Cheers,

  • #8 / Apr 26, 2012 4:36pm

    The Design Core

    359 posts

    I was not using any image add-ons, but since I could not get this to work without the error I had to move forward using imgSizer.

    The site has to go live tomorrow and I couldn’t waste any more time on this.

    The add-ons installed prior to using imgSizer are as follows:

    Freeform
    NSM Better Meta
    Mountee
    BW Required Category
    Custom System Messages
    Low Alphabet
    Low Seg2Cat
    GWcode Categories
    Sherlock

    I also just noticed that the File module is uninstalled. Would this need to be installed to use this functionality? I didn’t think it did.

    Thanks.

  • #9 / Apr 27, 2012 4:43pm

    Shane Eckert

    7174 posts

    Hello mediapimp,

    That is really odd. File module would not need to be installed and I am really perplexed as to why this was not working. I am really sorry I could not get this one solved quickly for you. I feel bad.

    If imgSizer is working for you, that’s awesome.

    Is there anything else I can attempt to help you with?

    Thank you,

  • #10 / Apr 27, 2012 5:46pm

    The Design Core

    359 posts

    Please don’t feel bad. These things happen.

    I do appreciate your help, and although I’d love to know why it’s not working, I just had to move on.

    Thanks again!

  • #11 / Apr 30, 2012 1:52pm

    Shane Eckert

    7174 posts

    Hey mediapimp,

    Gotacha. Thanks for the response.

    If you need anything else, please just let us know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases