# |
Jul 12th 2018, 17:18 |
chris-andre |
No. <img /> put into a html-string, then output. |
# |
Jul 12th 2018, 17:17 |
flavius |
https://tcpdf.org/examples/example_009/ |
# |
Jul 12th 2018, 17:17 |
flavius |
are you using `$pdfimg->Image()` function? |
# |
Jul 12th 2018, 17:16 |
chris-andre |
Allready tried full path. Yes, got to be something regarding "real" and "fake" as you mentions. |
# |
Jul 12th 2018, 17:14 |
flavius |
`<img src="http://...../users/img.jpg" />` |
# |
Jul 12th 2018, 17:14 |
flavius |
try with the full path |
# |
Jul 12th 2018, 17:13 |
flavius |
there has to be something different between the 'real' and the 'fake' |
# |
Jul 12th 2018, 17:12 |
chris-andre |
but still no image shown in PDF |
# |
Jul 12th 2018, 17:12 |
chris-andre |
So I got this now: >>> HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Content-Type: image/gif Content-Length: 201 Connection: keep-alive Pragma: no-cache Accept-Ranges: bytes Date: Thu, 12 Jul 2018 17:11:46 GMT Last-Modified: Thu, 12 Jul 2018 18:11:46 GMT Expires: Tue, 17 Jul 2018 17:11:46 GMT Cache-Control: public, max-age=432000 X-DEBUGKIT-ID: 4c93248d-82e4-43b2-aaaa-745a36ac377f |
# |
Jul 12th 2018, 17:10 |
flavius |
you can read more here -> https://book.cakephp.org/3.0/en/controllers/request-response.html#Cake\Http\Response::withCache |
# |
Jul 12th 2018, 17:10 |
chris-andre |
Allright. Ill try something right away. |
# |
Jul 12th 2018, 17:09 |
flavius |
i have something like this ``` // cache all images for 1 month $response = $response->withCache($record->created, '+1 month'); if($response->checkNotModified($request)) return $response; ``` |
# |
Jul 12th 2018, 17:08 |
chris-andre |
Thanks. |
# |
Jul 12th 2018, 17:08 |
chris-andre |
I have no idea how to set up a cache control. But I guess I'll find something to read up on that. |
# |
Jul 12th 2018, 17:07 |
slackebot4 |
max=94 Connection: Keep-Alive Content-Type: image/jpeg ``` |
# |
Jul 12th 2018, 17:07 |
flavius |
``` HTTP/1.1 200 OK Date: Thu, 12 Jul 2018 17:01:18 GMT Server: Apache/2.4.33 (Win64) OpenSSL/1.1.0h Expires: Sun, 12 Aug 2018 17:01:18 GMT Cache-Control: public, max-age=2678400, no-transform Pragma: no-cache Last-Modified: Tue, 10 Apr 2018 14:53:00 GMT Content-Length: 61445 X-DEBUGKIT-ID: 36b6effa-3a1e-4657-87b4-66a7d48e8384 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Keep-Alive: timeout=5, |
# |
Jul 12th 2018, 17:07 |
flavius |
try setting up a cache control? |
# |
Jul 12th 2018, 17:06 |
chris-andre |
Yes @flavius, it does. And like I said, it actually works with DomPdf. |
# |
Jul 12th 2018, 17:06 |
flavius |
'user/img' looks ok though |
# |
Jul 12th 2018, 17:05 |
chris-andre |
@josbeir Thank for the article, I will have a look and see if it meet my needs to header/footer, paging etc. |
# |
Jul 12th 2018, 17:02 |
flavius |
yeah, last one was cached |
# |
Jul 12th 2018, 17:02 |
chris-andre |
img/cake.power.gif >>>HTTP/1.1 304 Not Modified Server: nginx/1.14.0 (Ubuntu) Date: Thu, 12 Jul 2018 16:59:57 GMT Last-Modified: Tue, 10 Jul 2018 15:02:56 GMT Connection: keep-alive ETag: "5b44caa0-c9" |
# |
Jul 12th 2018, 17:01 |
chris-andre |
user/img >>>HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Date: Thu, 12 Jul 2018 16:59:33 GMT Content-Type: image/gif Content-Length: 201 Connection: keep-alive Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Accept-Ranges: bytes X-DEBUGKIT-ID: 3eb7bae3-0638-4f5d-a4d5-52fc34e894b9 |
# |
Jul 12th 2018, 17:01 |
flavius |
but also make sure the browser caches the "real" image :P so just check that little box to disable caching while dev tools is open |
# |
Jul 12th 2018, 17:00 |
josbeir |
=> https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/ |
# |
Jul 12th 2018, 16:59 |
flavius |
as in look at the 'response headers' |
# |
Jul 12th 2018, 16:59 |
chris-andre |
Allright. I used som CSS to repeat table head and break pages, but it is not as flexible as I need. |
# |
Jul 12th 2018, 16:58 |
flavius |
@chris-andre see exactly what the differences are between a "normal" image versus your url |
# |
Jul 12th 2018, 16:57 |
josbeir |
the css way |
# |
Jul 12th 2018, 16:57 |
chris-andre |
If I was just going to convert a page, sure. |
# |
Jul 12th 2018, 16:57 |
josbeir |
you can do headers with wkhtml2pdf |
# |
Jul 12th 2018, 16:57 |
chris-andre |
I need to set headers, footers, addPages etc. That's why I'm "leaving" CakePdf, and also why I don't use wkhtmltopdf. |
# |
Jul 12th 2018, 16:55 |
flavius |
how involved are you with TCPDF? maybe use @josbeir’s suggestion |
# |
Jul 12th 2018, 16:55 |
flavius |
lol |
# |
Jul 12th 2018, 16:55 |
chris-andre |
PDF is at least rendered, but without the image. |
# |
Jul 12th 2018, 16:54 |
chris-andre |
It seems like setting extension was one step forward @flavius |
# |
Jul 12th 2018, 16:53 |
josbeir |
also, make your life more easy and use wkhtmltopdf :P |
# |
Jul 12th 2018, 16:49 |
chris-andre |
Thanks. I will give i a try :slightly_smiling_face: |
# |
Jul 12th 2018, 16:48 |
flavius |
maybe TCPDF looks at extensions :slightly_smiling_face: |
# |
Jul 12th 2018, 16:47 |
flavius |
to the route |
# |
Jul 12th 2018, 16:47 |
flavius |
`<img src="/users/img.jpg" />` |