developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
#814 closed bug (fixed)
Erreurs avec tcpdf dans le trunk
Reported by: | dubphil | Owned by: | Julien |
---|---|---|---|
Priority: | high | Milestone: | jelix 1.1 |
Component: | jelix:core:pdf | Version: | 1.1RC3 |
Severity: | major | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description (last modified by laurentj)
Voici les erreurs générées lorsque j'exécute une action qui fait appel à une réponse tcpdf :
[notice 8] Use of undefined constant K_BLANK_IMAGE - assumed 'K_BLANK_IMAGE' /var/data/jelix/dev/lib/tcpdf/tcpdf.php 2041 [notice 8] Use of undefined constant K_PATH_IMAGES - assumed 'K_PATH_IMAGES' /var/data/jelix/dev/lib/tcpdf/tcpdf.php 2042 [warning 2] getimagesize(K_PATH_IMAGES../var/tcpdf/logo.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3655 [warning 2] Division by zero /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3664 [warning 2] getimagesize(K_PATH_IMAGES../var/tcpdf/logo.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3820 [exception 0] Missing or incorrect image file: K_PATH_IMAGES../var/tcpdf/logo.jpg /var/data/jelix/dev/lib/jelix/utils/jTcpdf.class.php 48
j'ai bien le dossier "pdf-fonts" dans "lib" et le fichier logo.jpg dans le dossier "var/tcpdf" de mon appli
Attachments (1)
Change History (12)
comment:1 Changed 12 years ago by laurentj
- Component changed from jelix to jelix:core:pdf
- Description modified (diff)
- Milestone set to jelix 1.1
- Owner set to Julien
- Severity changed from critical to major
- Version changed from trunk to 1.1RC3
comment:2 Changed 12 years ago by Julien
comment:3 Changed 12 years ago by Julien
- Status changed from new to assigned
Changed 12 years ago by Julien
comment:4 Changed 12 years ago by Julien
- review set to review?
Here's the patch for the trunk. I did setup the root directory for images to the app's root directory.
Also moved the cache directory to the app's temp directory.
comment:5 Changed 12 years ago by laurentj
- review changed from review? to review+
It's ok for me.
Although I think using a sub directory in the temp is better, for example:
define('K_PATH_CACHE', JELIX_APP_TEMP_PATH.'tcpdfcache/');
Isn't it ?
comment:6 Changed 12 years ago by Julien
the problem is that the code in tcpdf doesn't create the cache dir:
protected function _toJPEG($image) { $tempname = tempnam(K_PATH_CACHE,'jpg'); imagejpeg($image, $tempname, $this->jpeg_quality); imagedestroy($image); $retvars = $this->_parsejpeg($tempname); // tidy up by removing temporary image unlink($tempname); return $retvars; }
and I really don't want to change the source code of Tcpdf, due to the update frequency of this so big monster ;)
We could do a check about cache dir in jTcpdf and create it if it doesn't exist, but this would have performance impact.
I think we can use the app's temp directory directly, as temp files begin with 'jpg' with a random name and are destroyed immediately, so collisions shouldn't occur.
comment:7 Changed 12 years ago by laurentj
ok
comment:8 Changed 12 years ago by Julien
- Resolution set to fixed
- Status changed from assigned to closed
committed in the trunk and 1.1.x, r1291
comment:9 Changed 12 years ago by dubphil
ok problem solved, but since the last commit, jTcpdf.class.php is getting the logo.jpg file directly at the root of the app instead of in the var/tcpdf/ directory as previously designed.
imagesize(/var/data/jelix/dev/app/logo.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3655 [warning 2] Division by zero /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3664 [warning 2] getimagesize(/var/data/jelix/dev/app/logo.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory /var/data/jelix/dev/lib/tcpdf/tcpdf.php 3820 [exception 0] Missing or incorrect image file: /var/data/jelix/dev/app/logo.jpg /var/data/jelix/dev/lib/jelix/utils/jTcpdf.class.php 50
is this the expected behaviour ?
comment:10 Changed 12 years ago by Julien
if the path to the image is not specified as absolute (with a leading /), then it is relative to the app root directory.
I think it's ok that way because it's then easier to point everywhere in your app.
Where did you see that the default path was var/tcpdf/ ? I don't think it was that way, or it was resulting of a bug that was fixed with this change.
comment:11 Changed 12 years ago by dubphil
I can't find where I red this, but I certainly never decide it by myself :) nevertheless, this way is better so we can put the logo every where we want.
will check this afternoon