Yeah. But it’s only a tiny bit of extra code.

This is an example of paying through the nose for pay as you go… ;-)

I’ll commit my changes and we can then discuss whether we agree on the approach.

On Aug 8, 2016, at 5:34 PM, Alex Harui <[email protected]> wrote:

> Still feels like a separate component to me.  I'd have our basic Image
> have a String for source so you generally get the right type-checking, and
> a separate component that has a different property name or type and does
> this extra thinking, mainly because it should be possible to build an app
> without "the Blob".
> 
> My 2 cents,
> -Alex
> 
> On 8/8/16, 7:22 AM, "Harbs" <[email protected]> wrote:
> 
>> Almost exactly the same as a string, but you first need to get an
>> ObjectURL:
>> 
>> The four bold lines are pretty much the only difference:
>> 
>>           COMPILE::JS
>>           {
>>               if (_model.binary) {
>>                   var host:IUIBase = _strand as IUIBase;
>>                   (host.element as
>> HTMLImageElement).addEventListener('load',
>>                       loadHandler, false);
>>                   host.addEventListener('sizeChanged',
>>                       sizeChangedHandler);
>>                   if(_objectURL)
>>                       URLUtils.revokeObjectURL(_objectURL);
>>                   var blob:Blob = new Blob([_model.binary.array]);
>>                   _objectURL = URLUtils.createObjectURL(blob);
>>                   (host.element as HTMLImageElement).src = _objectURL;
>>               }
>>           }
>> 
>> All the URLUtils class does is call URL.createObjectURL() and
>> URL.revokeObjectURL(), but it deals with the differences in browsers.
>> 
>> On Aug 8, 2016, at 5:04 PM, Alex Harui <[email protected]> wrote:
>> 
>>> How do you set a binary image to a <img> tag in HTML?
>>> 
>>> Otherwise, my first reaction is that this sounds like a separate
>>> BitmapImage component.
>>> 
>>> Thoughts?
>>> -Alex
>>> 
>>> On 8/8/16, 6:06 AM, "Harbs" <[email protected]> wrote:
>>> 
>>>> I think it should be possible to specify a url source as a string.
>>>> 
>>>> On Aug 8, 2016, at 3:37 PM, Christofer Dutz <[email protected]>
>>>> wrote:
>>>> 
>>>>> How about a "source" property accepting source objects having
>>>>> UrlSource
>>>>> and BinarySource implementations?
>>>>> 
>>>>> Chris
>>>>> 
>>>>> 
>>>>> 
>>>>> Von meinem Samsung Galaxy Smartphone gesendet.
>>>>> 
>>>>> 
>>>>> -------- Ursprüngliche Nachricht --------
>>>>> Von: Harbs <[email protected]>
>>>>> Datum: 08.08.16 12:55 (GMT+01:00)
>>>>> An: dev <[email protected]>
>>>>> Betreff: FlexJS Image.source
>>>>> 
>>>>> I’m implementing support for setting binary data to images.
>>>>> 
>>>>> Currently, Image (and ImageModel, etc.) has a source property and a
>>>>> urlChanged event.
>>>>> 
>>>>> I can do one of two things:
>>>>> 
>>>>> 1. I can change source to url and add a binary property. This would go
>>>>> along with a “binaryChanged” event.
>>>>> 2. I can change source to untyped and allow setting (and getting) of
>>>>> either strings or BinaryData. I think the event name should be changed
>>>>> to “sourceChanged”.
>>>>> 
>>>>> I started implementing it the first way, but I wanted to hear if
>>>>> anyone
>>>>> has a compelling reason to do it the second way.
>>>>> 
>>>>> Harbs
>>>> 
>>> 
>> 
> 

Reply via email to