«
Image Item are supported
type | name |
---|---|
Image | Image |
Image.update "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
after 3.seconds do
logger.info("Mime type: #{Image.mime_type}")
logger.info("Number of bytes: #{Image.bytes.length}")
end
Image.update "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
after 3.seconds do
logger.info("Mime type: #{Image.mime_type}")
logger.info("Number of bytes: #{Image.bytes.length}")
end
require 'tmpdir'
Image.update_from_bytes(<update_parameters>)
after 3.seconds do
logger.info("Mime type: #{Image.mime_type}")
logger.info("Number of bytes: #{Image.bytes.length}")
end
update_parameters | |
---|---|
IO.binread(File.join('<%=Dir.tmpdir%>','1x1.png')), mime_type: 'image/png' | |
IO.binread(File.join('<%=Dir.tmpdir%>','1x1.png')) |
require 'tmpdir'
Image.update_from_file(<update_parameters>)
after 3.seconds do
logger.info("Mime type: #{Image.mime_type}")
logger.info("Number of bytes: #{Image.bytes.length}")
end
update_parameters | mime_type | |
---|---|---|
File.join('<%=Dir.tmpdir%>','1x1.png') | image/png | |
File.join('<%=Dir.tmpdir%>','1x1.png'), mime_type: 'foo/bar' | foo/bar |
Image.update_from_url 'https://raw.githubusercontent.com/boc-tothefuture/openhab-jruby/main/features/assets/1x1.png'
after 3.seconds do
logger.info("Mime type: #{Image.mime_type}")
logger.info("Number of bytes: #{Image.bytes.length}")
end