| import UIKit | |
| import MobileCoreServices.UTCoreTypes | |
| if #available(iOS 14.1, *) { | |
| let input = Bundle.main.url(forResource: "IMG_0037", withExtension: "HEIC")! | |
| let output = FileManager().temporaryDirectory.appendingPathComponent("IMG_0037.GAIN_MAP.BMP") | |
| let source = CGImageSourceCreateWithURL(input as CFURL, nil)! | |
| // urn:com:apple:photo:2020:aux:hdrgainmap | |
| let dataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)! as Dictionary |
| lass KeenHttpOutput < Fluent::Output | |
| Fluent::Plugin.register_output('out-keen-http', self) | |
| def initialize | |
| super | |
| require 'rubygems' | |
| require 'eventmachine' | |
| require 'em-http-request' | |
| require 'cgi' | |
| require 'json' |
The BBC has a server-side image service which provides developers with multiple sized versions of any image they request. It works in a similar fashion to http://placehold.it/ but it also handles the image ratios returned (where as placehold.it doesn't).
The original BBC News process (and my re-working of the script) follows roughly these steps...
divs within the page (which have a class of delayed-image-load) into a transparent GIF using a Base64 encoded string.
width & height HTML attributes of the image to the required sizediv has custom data-attr set server-side to the size of the imageimage-replace onto each newly created transparent imagesetTimeout to unblock the UI thread and which calls a function resizeImages which enhances the image-replace images so their source is now set to a URL whe