0

I'm fairly new so please forgive any lack of knowledge I may have.

I'm using the cycle2 plugin on a project and I've made one slideshow on my index page work fine, there's no issues with it at all as its pulling images from the net.

However I want to do a slideshow on the show page, so that for each product it pulls the product image from the database. I've made it so it does, however when doing so the first image of the slideshow is always empty and continuously trying to load until it changes to the picture from the database.

I'm pretty sure its something in the img src that I'm doing wrong as its getting the image, just getting a blank slide too, any help would be greatly appreciated!

The code so far is;

        <div id="slideshow">

                        <div class="cycle-slideshow" 
                            data-cycle-fx=scrollHorz
                            data-cycle-timeout=4000
                            style="z-index:-1;"
                            data-cycle-prev="#prev"
                            data-cycle-next="#next"
                            >
                            <!-- empty element for pager links -->
                            <div class="cycle-pager"></div>
                                <!-- empty element for overlay -->
                            <img src =  <%= link_to image_tag @product.image_url %>>
                        <!-- prev/next links -->
                        <div id=outside>
                        <span id=prev><a href="#" class="button1">?</a></span>
                        <span id=next><a href="#" class="button1">? </a></span>

                </div>
        </div>

Thanks, Ben

1 Answer 1

0

Use this: <%= image_tag(product.image_url) %>. That's what I used to make mine work.

1
  • Hi there, forgot I posted this! managed to sort it in the end with: <%= image_tag(@product.image_url) %> Works a charm, Thanks.
    – Ben Murphy
    Mar 13, 2014 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.