Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-45322

Portfolio export of embedded images wrapped in a link

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 2.6.2
    • Portfolio
    • MOODLE_26_STABLE

      When exporting a content that contains an image, which is wrapped in a link pointing to itself, or another embedded file, either:

      • the image is removed or;
      • the link disappears.

              // Test with img in a link pointing to another file.
              $input = '<p><a href="@@PLUGINFILE@@' . $filepath . $filenamepdf . '">' .
                  '<img src="@@PLUGINFILE@@' . $filepath . $filenameimg . '"></a></p>';
              $expected = '<p><a href="files/'. $filenamepdf . '"><img src="files/' . $filenameimg . '"></a></p>';
              $output = portfolio_rewrite_pluginfile_urls($input, $context->id, $component, $filearea, $itemid, $format, $options);
              $this->assertSame($expected, $output);
       
              // Test with img in a link pointing to the image.
              $input = '<p><a href="@@PLUGINFILE@@' . $filepath . $filenameimg . '">' .
                  '<img src="@@PLUGINFILE@@' . $filepath . $filenameimg . '"></a></p>';
              $expected = '<p><a href="files/'. $filenameimg . '"><img src="files/' . $filenameimg . '"></a></p>';
              $output = portfolio_rewrite_pluginfile_urls($input, $context->id, $component, $filearea, $itemid, $format, $options);
              $this->assertSame($expected, $output);
      

      Actually, anything in a link to a file will be stripped out.

            Unassigned Unassigned
            fred Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.