Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In TCPDF 6.3.4 after pdf render images with base64 not appear #179

Open
eliel-jr opened this issue Feb 13, 2020 · 6 comments
Open

In TCPDF 6.3.4 after pdf render images with base64 not appear #179

eliel-jr opened this issue Feb 13, 2020 · 6 comments

Comments

@eliel-jr
Copy link

I'm use PHP 7.2.5 and after update TCPDF to 6.3.4, not rendering images with base64

images with filepath render OK.

on v6.2.13 rendering OK.

HTML example in text that not rendering base64

html_example.txt

@eliel-jr
Copy link
Author

I'm testing versions: v6.3.4, v6.3.3, v6.3.2, v6.3.1, v6.3.0, v6.2.26, v6.2.25, v6.2.23, v6.2.22 and all broken

in v6.2.21 render OK.

@LittleBigFox
Copy link

LittleBigFox commented Feb 13, 2020

Hi!

I'd the same problem, just replace the tcpdf/include/tcpdf_static.php function file_exists (L1879 in tcpdf 6.3.4) like this:

public static function file_exists($filename) {

if (preg_match('|^https?://|', $filename) == 1) {
    return self::url_exists($filename);
} 

if(stripos($filename,'data:')===0) {
    return true;
}

if (strpos($filename, '://')) {
      return false; // only support http and https wrappers for security reasons
}

return @file_exists($filename);

}

@Vitexus
Copy link

Vitexus commented Mar 27, 2020

spipu/html2pdf#413

alejomoreira added a commit to alejomoreira/TCPDF that referenced this issue Jun 21, 2021
@clickmeplz
Copy link

Version 6.2.21 works fine in local and server. I have 6.3.2 and render Ok in local and not works in server.
Above solution not working for me. I checked with 6.3.2 and 6.4.4

@detook
Copy link

detook commented Oct 31, 2022

Do this
<img src="@/9j/4AAQ....
instead of
<img src="data:image/png;base64,/9j/4AAQ....

compojoom added a commit to compojoom/TCPDF that referenced this issue Dec 1, 2023
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text. 

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead. 

tecnickcom#179
@compojoom
Copy link

@detook solution works, but so is @LittleBigFox's if one is ok with modifying the static file.

I personally find it very sad that we have to add an @ instead of the default:

data:image/png;base64

I've created a PR with @LittleBigFox's fix:
#671

compojoom added a commit to compojoom/TCPDF that referenced this issue Apr 22, 2024
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text. 

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead. 

tecnickcom#179
compojoom added a commit to compojoom/TCPDF that referenced this issue Apr 22, 2024
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text.

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead.

tecnickcom#179

Update include/tcpdf_static.php

Co-authored-by: William Desportes <williamdes@wdes.fr>
compojoom added a commit to compojoom/TCPDF that referenced this issue Apr 22, 2024
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text.

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead.

tecnickcom#179

Update include/tcpdf_static.php

Co-authored-by: William Desportes <williamdes@wdes.fr>
compojoom added a commit to compojoom/TCPDF that referenced this issue Apr 22, 2024
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text.

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead.

tecnickcom#179

Update include/tcpdf_static.php

Co-authored-by: William Desportes <williamdes@wdes.fr>
compojoom added a commit to compojoom/TCPDF that referenced this issue Apr 22, 2024
I'm not sure when this happened, but default base64 encoded images were no longer rendered in html  text.

If the image is rendered like this:
```
<img src="data:image/png;base64,....." />
```

the image was not rendered when inside of an html text. Instead one has to replace `data:image/png;base64,` with `@`which in my opinion is not ideal and an overhead.

tecnickcom#179

Update include/tcpdf_static.php

Co-authored-by: William Desportes <williamdes@wdes.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants