mirror of
https://github.com/tecnickcom/TCPDF.git
synced 2025-03-20 22:19:39 +01:00
Make sure we don\t check the same for existing multiple times
This commit is contained in:
parent
5a3b44c729
commit
210ff2239f
21
tcpdf.php
21
tcpdf.php
@ -6885,7 +6885,7 @@ class TCPDF {
|
||||
$exurl = $file;
|
||||
}
|
||||
// check if file exist and it is valid
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
if (!@$this->fileExists($file)) {
|
||||
return false;
|
||||
}
|
||||
if (($imsize = @getimagesize($file)) === FALSE) {
|
||||
@ -24579,6 +24579,11 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
|
||||
// --- END SVG METHODS -----------------------------------------------------
|
||||
|
||||
/**
|
||||
* Keeps files in memory, so it doesn't need to downloaded everytime in a loop
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
protected function getCachedFileContents($file)
|
||||
{
|
||||
if (!isset($this->fileContentCache[$file])) {
|
||||
@ -24587,6 +24592,20 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
return $this->fileContentCache[$file];
|
||||
}
|
||||
|
||||
/**
|
||||
* Make use of the file content cache, to avoid a lot of calls to an external server to see if a file exists
|
||||
* @param string $file
|
||||
* @return bool
|
||||
*/
|
||||
protected function fileExists($file)
|
||||
{
|
||||
if (isset($this->fileContentCache[$file])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return TCPDF_STATIC::file_exists($file);
|
||||
}
|
||||
|
||||
} // END OF TCPDF CLASS
|
||||
|
||||
//============================================================+
|
||||
|
Loading…
x
Reference in New Issue
Block a user