mirror of
https://github.com/dpnmw/community-landing.git
synced 2026-03-18 09:27:16 +00:00
Logo base64 encoding
This commit is contained in:
BIN
assets/images/badge-dark.png
Normal file
BIN
assets/images/badge-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
assets/images/badge-light.png
Normal file
BIN
assets/images/badge-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -863,12 +863,15 @@ module CommunityLanding
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_designer_badge
|
def render_designer_badge
|
||||||
dark_logo = File.join(CommunityLanding::PLUGIN_DIR, "..", "logo-dark.png")
|
dark_logo = File.join(CommunityLanding::PLUGIN_DIR, "assets", "images", "badge-dark.png")
|
||||||
light_logo = File.join(CommunityLanding::PLUGIN_DIR, "..", "logo-light.png")
|
light_logo = File.join(CommunityLanding::PLUGIN_DIR, "assets", "images", "badge-light.png")
|
||||||
return "" unless File.exist?(dark_logo) && File.exist?(light_logo)
|
|
||||||
|
|
||||||
|
begin
|
||||||
dark_b64 = Base64.strict_encode64(File.binread(dark_logo))
|
dark_b64 = Base64.strict_encode64(File.binread(dark_logo))
|
||||||
light_b64 = Base64.strict_encode64(File.binread(light_logo))
|
light_b64 = Base64.strict_encode64(File.binread(light_logo))
|
||||||
|
rescue StandardError
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
html = +""
|
html = +""
|
||||||
html << "<div class=\"cl-designer-badge\" id=\"cl-designer-badge\">\n"
|
html << "<div class=\"cl-designer-badge\" id=\"cl-designer-badge\">\n"
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ enabled_site_setting :community_landing_enabled
|
|||||||
|
|
||||||
register_asset "stylesheets/community_landing/admin.css", :admin
|
register_asset "stylesheets/community_landing/admin.css", :admin
|
||||||
|
|
||||||
|
require "base64"
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
module ::CommunityLanding
|
module ::CommunityLanding
|
||||||
PLUGIN_NAME = "community-landing"
|
PLUGIN_NAME = "community-landing"
|
||||||
|
|||||||
Reference in New Issue
Block a user