##// END OF EJS Templates
Make svg, jpeg and png images resizable in notebook.
Brian Granger -
Show More
@@ -275,21 +275,35 b' var IPython = (function (IPython) {'
275
275
276 OutputArea.prototype.append_svg = function (svg, element) {
276 OutputArea.prototype.append_svg = function (svg, element) {
277 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_svg");
277 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_svg");
278 toinsert.append(svg);
278 var img = $('<div/>');
279 img.append(svg);
280 var h = img.find('svg').attr('height');
281 var w = img.find('svg').attr('width');
282 img.width(w).height(h);
283 img.resizable({'aspectRatio': true});
284 toinsert.append(img);
279 element.append(toinsert);
285 element.append(toinsert);
280 };
286 };
281
287
282
288
283 OutputArea.prototype.append_png = function (png, element) {
289 OutputArea.prototype.append_png = function (png, element) {
284 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_png");
290 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_png");
285 toinsert.append($("<img/>").attr('src','data:image/png;base64,'+png));
291 var img = $("<img/>").attr('src','data:image/png;base64,'+png);
292 img.load(function () {
293 $(this).resizable({'aspectRatio': true})
294 });
295 toinsert.append(img);
286 element.append(toinsert);
296 element.append(toinsert);
287 };
297 };
288
298
289
299
290 OutputArea.prototype.append_jpeg = function (jpeg, element) {
300 OutputArea.prototype.append_jpeg = function (jpeg, element) {
291 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_jpeg");
301 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_jpeg");
292 toinsert.append($("<img/>").attr('src','data:image/jpeg;base64,'+jpeg));
302 var img = $("<img/>").attr('src','data:image/jpeg;base64,'+jpeg);
303 img.load(function () {
304 $(this).resizable({'aspectRatio': true})
305 });
306 toinsert.append(img);
293 element.append(toinsert);
307 element.append(toinsert);
294 };
308 };
295
309
General Comments 0
You need to be logged in to leave comments. Login now