mirror of
https://github.com/tecnickcom/TCPDF.git
synced 2025-03-20 22:19:39 +01:00
Minimize other outgoing image calls
This commit is contained in:
parent
210ff2239f
commit
038d0d5266
18
tcpdf.php
18
tcpdf.php
@ -6888,15 +6888,11 @@ class TCPDF {
|
||||
if (!@$this->fileExists($file)) {
|
||||
return false;
|
||||
}
|
||||
if (($imsize = @getimagesize($file)) === FALSE) {
|
||||
if (in_array($file, $this->imagekeys)) {
|
||||
// get existing image data
|
||||
$info = $this->getImageBuffer($file);
|
||||
$imsize = array($info['w'], $info['h']);
|
||||
} elseif (strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE) {
|
||||
$imgdata = $this->getCachedFileContents($file);
|
||||
}
|
||||
}
|
||||
if (false !== $info = $this->getImageBuffer($file)) {
|
||||
$imsize = array($info['w'], $info['h']);
|
||||
} elseif (($imsize = @getimagesize($file)) === FALSE && strpos($file, '__tcpdf_'.$this->file_id.'_img') === FALSE){
|
||||
$imgdata = $this->getCachedFileContents($file);
|
||||
}
|
||||
}
|
||||
if (!empty($imgdata)) {
|
||||
// copy image to cache
|
||||
@ -24593,13 +24589,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
}
|
||||
|
||||
/**
|
||||
* Make use of the file content cache, to avoid a lot of calls to an external server to see if a file exists
|
||||
* Avoid multiple 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])) {
|
||||
if (isset($this->fileContentCache[$file]) || false !== $this->getImageBuffer($file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user