Skip to content
This repository has been archived by the owner on Jun 6, 2020. It is now read-only.

How can i change image src path? #39

Open
jadesenberg opened this issue Aug 15, 2017 · 1 comment
Open

How can i change image src path? #39

jadesenberg opened this issue Aug 15, 2017 · 1 comment

Comments

@jadesenberg
Copy link

jadesenberg commented Aug 15, 2017

Hi guys is there a way that i can change the image src path in config?

img src="change this"

Thanks in advance

@Dave-Morton
Copy link

Dave-Morton commented Mar 27, 2018

@jadesenberg I ran up against this as well, and found (part of ) a solution for this. I added the following PHP code to my script:

// change output file location
define('IMAGE_PATH', BASE_PATH . 'images' . DIRECTORY_SEPARATOR);
define('IMAGE_URL', BASE_URL . 'images/');
// BASE_PATH and BASE_URL set elsewhere in the script
list($fn, $ext) = explode('.', $filename);

Config::set('pdftohtml.output', IMAGE_PATH . "{$fn}/");

but that only solved half of the problem. The HTML and image output of the chosen PDF file now goes to the correct place, and would likely work if I were to header({location}) to the HTML page, but I'm using a viewer within an <iframe> element, so wish to echo the HTML instead. As such, when doing this, the location of the image's src ends up being wrong, so I also have to use the following code, too:

$content = str_replace('src="', 'src="' .  IMAGE_URL, $content);

it's a bit hacky, but it does work for what I need. I hope this proves useful to you. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants