diff --git a/cellpack/autopack/writers/__init__.py b/cellpack/autopack/writers/__init__.py index c0da4c13..db0d61f5 100644 --- a/cellpack/autopack/writers/__init__.py +++ b/cellpack/autopack/writers/__init__.py @@ -511,18 +511,20 @@ def add_images(self, header, image_text, filepaths): ) if len(image_text) == len(filepaths): for i in range(len(filepaths)): + img_path = f"{self.output_image_location} / {filepaths[i].name}" self.report_md.new_line( self.report_md.new_inline_image( text=image_text[i], - path=str(self.output_image_location / filepaths[i].name), + path=img_path, ) ) else: for i in range(len(filepaths)): + img_path = f"{self.output_image_location} / {filepaths[i].name}" self.report_md.new_line( self.report_md.new_inline_image( text=image_text[0], - path=str(self.output_image_location / filepaths[i].name), + path=img_path, ) ) self.report_md.new_line("") diff --git a/cellpack/tests/test_markdown_writer.py b/cellpack/tests/test_markdown_writer.py index 276e1eb3..f2acee42 100644 --- a/cellpack/tests/test_markdown_writer.py +++ b/cellpack/tests/test_markdown_writer.py @@ -82,10 +82,10 @@ def test_add_image(setup_md_writer, tmp_path): writer, report_path = setup_md_writer header = "Test Image" image_text = ["Image 1", "Image 2"] - filepaths = ["image1.png", "image2.png"] + filepaths = [tmp_path / "image1.png", tmp_path / "image2.png"] for image in filepaths: - (tmp_path / image).touch() + image.touch() writer.add_images(header, image_text, filepaths) writer.write_file()