Places an image from file 'fileName' on the active html page. Copies the image file to the 'img.' subdirectory of the 'html/' directory and creates a link to this file on the active html page. :param fileName: Name of the image file, must be located in the in
(fileName, width, label='', caption='')
| 457 | return html |
| 458 | |
| 459 | def img2html(fileName, width, label='', caption=''): |
| 460 | """ |
| 461 | Places an image from file 'fileName' on the active html page. |
| 462 | |
| 463 | Copies the image file to the 'img.' subdirectory of the 'html/' directory |
| 464 | and creates a link to this file on the active html page. |
| 465 | |
| 466 | :param fileName: Name of the image file, must be located in the |
| 467 | ini.img_path folder. |
| 468 | |
| 469 | :type fileName: str |
| 470 | |
| 471 | :param width: With of the image in pixels |
| 472 | :type width: int |
| 473 | :param label: ID of the label to be assigned to this image, defaults to ''. |
| 474 | :type label: str |
| 475 | :param caption: Caption for this image; defaults to ''. |
| 476 | :type caption: str |
| 477 | :return: file path for this image. |
| 478 | :rtype: str |
| 479 | """ |
| 480 | label = _addLabel(label, fileName=fileName, caption=caption, labelType="fig") |
| 481 | try: |
| 482 | copy2(ini.img_path + fileName, ini.html_path + 'img/' + fileName) |
| 483 | except: |
| 484 | print("Warning: could not copy: '{0}'.".format(fileName)) |
| 485 | html = '<figure>{0}<img src="img/{1}" alt="{2}" style="width:{3}px">\n'.format(label, fileName, caption, width) |
| 486 | if caption != '': |
| 487 | html+='<figcaption>Figure: %s<br>%s</figcaption>\n'%(fileName, caption) |
| 488 | html += '</figure>\n' |
| 489 | html = _insertHTML(ini.html_path + ini.html_page, html) |
| 490 | return html |
| 491 | |
| 492 | def csv2html(fileName, label='', separator=',', caption=''): |
| 493 | """ |
no test coverage detected