![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
refinerycms-page-images
Advanced tools
Page Images allows you to relate one or more images to any page in Refinery which makes it really easy for you to create simple image galleries with lightbox style popups on the front end page views.
Add this line to your application's Gemfile
gem 'refinerycms-page-images', '~> 4.0.0', git: "https://github.com/refinery/refinerycms-page-images", branch: "master"
Next run
bundle install
rails generate refinery:page_images
rake db:migrate
Now when you start up your Refinery application, edit a page and there should be a new "Images" tab.
Note: the following information about assets on Heroku might be out of date.
In order to properly precompile assets on Heroku, config vars must be present in the environment during slug compilation.
heroku labs:enable user-env-compile -a myapp
otherwise you may experience the following error:
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
You can enable captions using an initializer containing the following configuration:
# app/config/initializers/refinery/page-images.rb
Refinery::PageImages.captions = true
By default, captions are WYM editors. Prefer textarea
s? Gotcha :
Refinery::PageImages.wysiwyg = false
Note that WYMeditor support requires that you have the extension in your Gemfile:
gem 'refinerycms-wymeditor', ['~> 2.0', '>= 2.0.0']
app/views/refinery/pages/show.html.erb
If you don't have this file then Refinery will be using its default. You can override this with
rake refinery:override view=refinery/pages/show
If images have been assigned to a page several objects are available for showing on the page. They are
@page.images
: A collection of images assigned to the page.@page.caption_for_image_index(i)
will return the caption (if any) for the ith image in @page.images@page.images_with_captions
: A collection of image_with_caption objects with the attributes image: and caption:<% content_for :body_content_right do %>
<ul id='gallery'>
<% @page.images.each do |image| %>
<li>
<%= link_to image_tag(image.thumbnail(geometry: "200x200#c").url),
image.thumbnail(geometry: "900x600").url %>
</li>
<% end %>
</ul>
<% end %>
<%= render :partial => "/refinery/content_page" %>
If you have enabled captions, you can show them like this
<% content_for :body_content_right do %>
<section id='gallery'>
<% @page.images.each_with_index do |image, index| %>
<figure>
<%= link_to image_tag(image.thumbnail(geometry: "200x200#c").url),
image.thumbnail(geometry: "900x600").url %>
<figcaption><%=raw @page.caption_for_image_index(index) %></figcaption>
</figure>
<% end %>
</section>
<% end %>
<%= render :partial => "/refinery/content_page" %>
or like this
<% content_for :body_content_right do %>
<section id='gallery'>
<% @page.images_with_captions.each do |iwc| %>
<figure>
<%= link_to image_tag(iwc.image.thumbnail(geometry: "200x200#c").url),
iwc.image.thumbnail(geometry: "900x600").url %>
<figcaption><%=raw iwc.caption %></figcaption>
</figure>
<% end %>
</section>
<% end %>
<%= render :partial => "/refinery/content_page" %>
Contrary to its name, refinerycms-page-images
also works with refinerycms-blog
and adds the functionality to link images to blog posts.
If refinerycms-blog
is installed on your rails app, refinerycms-page-images
will automatically detect it and perform the adequate initialization. PageImages are assigned to a polymorph "page" object, wich can be a Refinery::Page
or a Blog::Post
.
Thus, once installed, you can simply call a blog post's images the same way you'd call them for a page, like this
<% @blog_posts.each do |blog_post| %>
<ul id='gallery'>
<% blog_post.images.each do |image| %>
<li>
<%= link_to image_tag(image.thumbnail(geometry: "200x200#c").url),
image.thumbnail(geometry: "900x600").url %>
</li>
<% end %>
</ul>
<% end %>
<%= render :partial => "/refinery/content_page" %>
FAQs
Unknown package
We found that refinerycms-page-images demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.