Show More
@@ -613,19 +613,21 b' var IPython = (function (IPython) {' | |||
|
613 | 613 | }); |
|
614 | 614 | }, 250); |
|
615 | 615 | }; |
|
616 | ||
|
617 | ||
|
616 | ||
|
617 | var set_width_height = function (img, md, mime) { | |
|
618 | // set width and height of an img element from metadata | |
|
619 | var height = _get_metadata_key(md, 'height', mime); | |
|
620 | if (height !== undefined) img.setAttribute('height', height); | |
|
621 | var width = _get_metadata_key(md, 'width', mime); | |
|
622 | if (width !== undefined) img.setAttribute('width', width); | |
|
623 | }; | |
|
624 | ||
|
618 | 625 | OutputArea.prototype.append_png = function (png, md, element) { |
|
619 | 626 | var type = 'image/png'; |
|
620 | 627 | var toinsert = this.create_output_subarea(md, "output_png", type); |
|
621 | 628 | var img = $("<img/>"); |
|
622 | 629 | img[0].setAttribute('src','data:image/png;base64,'+png); |
|
623 | if (md['height']) { | |
|
624 | img[0].setAttribute('height', md['height']); | |
|
625 | } | |
|
626 | if (md['width']) { | |
|
627 | img[0].setAttribute('width', md['width']); | |
|
628 | } | |
|
630 | set_width_height(img[0], md, 'image/png'); | |
|
629 | 631 | this._dblclick_to_reset_size(img); |
|
630 | 632 | toinsert.append(img); |
|
631 | 633 | element.append(toinsert); |
@@ -636,12 +638,7 b' var IPython = (function (IPython) {' | |||
|
636 | 638 | var type = 'image/jpeg'; |
|
637 | 639 | var toinsert = this.create_output_subarea(md, "output_jpeg", type); |
|
638 | 640 | var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg); |
|
639 | if (md['height']) { | |
|
640 | img.attr('height', md['height']); | |
|
641 | } | |
|
642 | if (md['width']) { | |
|
643 | img.attr('width', md['width']); | |
|
644 | } | |
|
641 | set_width_height(img[0], md, 'image/jpeg'); | |
|
645 | 642 | this._dblclick_to_reset_size(img); |
|
646 | 643 | toinsert.append(img); |
|
647 | 644 | element.append(toinsert); |
General Comments 0
You need to be logged in to leave comments.
Login now