attachinary icon indicating copy to clipboard operation
attachinary copied to clipboard

Dimensions for Remove thumbnail

Open firecall opened this issue 11 years ago • 1 comments

Is there a way to specify the dimensions of the Thumbnail for the Remove action when using the f.attachinary_file_field form helper?

It's set to thumbnail size of 75x75. Wondering if I can configure those dimensions when it's generated by the helper.

Thanks.

Awesome gem - just dumped loads of my code doing the same thing with PaperClip :-)

firecall avatar Mar 22 '14 10:03 firecall

You can pass in a custom template when you initialize the input field. Here is a coffeescript example where I use a custom transformation. See https://github.com/assembler/attachinary/blob/master/lib/assets/javascripts/attachinary.js.coffee

  $(".attachinary-input").attachinary(
      template: """
        <ul>
          <% for(var i=0; i<files.length; i++){ %>
            <li>
              <% if(files[i].resource_type == "raw") { %>
                <div class="raw-file"></div>
              <% } else { %>
                <img
                  src="<%= $.cloudinary.url(files[i].public_id, { "version": files[i].version, "format": 'jpg', "transformation": 'my_custom_transformation' }) %>"
                  alt="" width="320" height="320" />
              <% } %>
              <a href="#" data-remove="<%= files[i].public_id %>">Remove</a>
            </li>
          <% } %>
        </ul>
      """
  )

cwsaylor avatar Oct 02 '14 20:10 cwsaylor