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.

Images in a Post

May 12, 2012 4:24pm

Subscribe [2]
  • #1 / May 12, 2012 4:24pm

    gazettejournal

    8 posts

    I think I need fresh eyes to help me on this.

    I just upgraded on a local test server (MAMP) to EE2.5. The sites was previously running 1.7.1 - and successfully using LG Replace with Matrix and Image Sizer to place images inside of posts. That code looked like this:

    <!-- Code to place images -->
    {exp:lg_replace:haystack needles="{cf_images backspace="1"}image_{row_count}|{/cf_images}"}
    <!-- Now loop through the matrix and create the individual links -->
    {cf_images}
    {exp:lg_replace:replacement needle="image_{row_count}"}
    <div class="{align}"><a href="http://{image}">{exp:imgsizer:size src="{image}" auto="{size}" title="{caption}" alt="{caption}"}</a>
    {caption}
    </div>
    {/exp:lg_replace:replacement}
    {/cf_images}
    <!-- End of loop -->
    
    {body}
    
    <!--closing tag for code to place images-->
    {/exp:lg_replace:haystack} 
    <!--end image code-->

    I understand that LG Replace is not for EE2, so I got NSM Transplant. Also, support for Image Sizer seems nonexistent so I purchased CE Image. UPdated to the latest Matrix, tested file paths, etc. but can’t get images to appear. I;ve looked all over and found a little bit of sample code, but somehow (maybe I’m just substituting things in the wrong place) I still can’t get it to work. 

    Here is the code I am trying now:
    Changes - matrix field changed from cf_images to matrix_image

    <!-- Code to place images -->
    
    {exp:nsm_transplant:body}
        {matrix_image}
        {exp:nsm_transplant:content id="image{row_count}"}
        <div class="{align}">
            {exp:ce_img:make src="{image}" max_height="{size}"}
            {made}
            {/exp:ce_img:make}
            {if caption}{caption}{/if}
        </div>
        {/exp:nsm_transplant:content}
        {/matrix_image}
     
    <!-- End of loop -->
    
    {body}
    
    <!--closing tag for code to place images-->
    {/exp:nsm_transplant:body} 
    <!--end image code-->

    I feel like I can’t even see it right now - can anyone enlighten me?
    This newspaper publishes again on Wednesday and I need this function.
    Thanks.

     

  • #2 / May 14, 2012 3:23pm

    gazettejournal

    8 posts

    Aha - after some sleep it became clear: I was missing the underscore.

    image_{row_count}

     

  • #3 / May 14, 2012 3:28pm

    Shane Eckert

    7174 posts

    Hi gazettejournal,

    I was in the process of replying and you posted!

    I am glad you found the issue, thanks for letting me know!

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

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases