Edit images src.

This commit is contained in:
BoHung Chiu 2022-01-17 20:05:10 +08:00
parent 1cbf58f91b
commit 3d2a33a9b8
1 changed files with 10 additions and 5 deletions

View File

@ -65,12 +65,17 @@ class GalleriesController < ApplicationController
doc = Nokogiri::HTML(a.description.to_s)
alt_text = doc.text.empty? ? 'gallery image' : doc.text
colors = album_color_map[a.id] || []
thumb_src = a.cover_path || "/assets/gallery/default.jpg"
{
"album-name" => a.name,
"album-description" => a.description,
"alt_title" => alt_text,
"link_to_show" => OrbitHelper.url_to_show(a.to_param),
"thumb-src" => a.cover_path || "/assets/gallery/default.jpg",
"thumb-src" => thumb_src,
"src" => thumb_src.sub('thumb_','') ,
"thumb-large-src" => thumb_src.sub("thumb_","thumb_large_"),
"mobile-src" => thumb_src.sub("thumb_","mobile_"),
"theater-src" => thumb_src.sub("thumb_","theater_"),
"album_color" => iterate_data(colors[1],colors[0],@album_setting.album_card_background_color,'transparent'),
"album_card_text_color" => iterate_data(colors[2],@album_setting.album_card_text_color)
}
@ -161,11 +166,11 @@ class GalleriesController < ApplicationController
"album-description" => a.description,
"alt_title" => alt_text,
"link_to_show" => OrbitHelper.widget_more_url + "/" + a.to_param + "#" + (cover_image.id.to_s rescue ""),
"src" => thumb_src.gsub("thumb_",""),
"src" => thumb_src.sub("thumb_",""),
"thumb-src" => thumb_src,
"thumb-large-src" => thumb_src.gsub("thumb_","thumb_large_"),
"mobile-src" => thumb_src.gsub("thumb_","mobile_"),
"theater-src" => thumb_src.gsub("thumb_","theater_"),
"thumb-large-src" => thumb_src.sub("thumb_","thumb_large_"),
"mobile-src" => thumb_src.sub("thumb_","mobile_"),
"theater-src" => thumb_src.sub("thumb_","theater_"),
"image_description" => image_description,
"image_short_description" => image_short_description,
"album_color" => iterate_data(colors[1],colors[0],@album_setting.album_card_background_color,'transparent'),