| @@ 168-194 (lines=27) @@ | ||
| 165 | $attachments = array(); |
|
| 166 | preg_match_all('/\<img\ src\=\"\$attachURL\/.*\".*\>/', $this->content, $attachments); |
|
| 167 | ||
| 168 | foreach ($attachments[0] as $attachmentURL) { |
|
| 169 | $start = mb_strpos($attachmentURL, '/'); |
|
| 170 | $end = mb_strrpos($attachmentURL, '" alt'); |
|
| 171 | $fileName = mb_substr($attachmentURL, $start + 1, $end - ($start + 1)); |
|
| 172 | ||
| 173 | if ($config->get('cms.images.widget')) { |
|
| 174 | // get the details of the source image |
|
| 175 | $path = $this->BO->getAttachmentsLocation().'/'.$fileName; |
|
| 176 | $image_details = getimagesize($path); |
|
| 177 | $imgType = $image_details[2]; |
|
| 178 | if ($imgType == 1) { |
|
| 179 | $type = 'gif'; |
|
| 180 | } elseif ($imgType == 2) { |
|
| 181 | $type = 'jpg'; |
|
| 182 | } elseif ($imgType == 3) { |
|
| 183 | $type = 'png'; |
|
| 184 | } |
|
| 185 | ||
| 186 | $img = new Image($path, $image_details[0], $image_details[1], $type, 0.95, false, (boolean) $config->get('cms.images.widget.secure')); |
|
| 187 | $this->content = str_replace($attachmentURL, $img->renderHTMLLink(), $this->content); |
|
| 188 | } else { |
|
| 189 | // render a normal image link to the ViewAttachment controller |
|
| 190 | if (method_exists($this->BO, 'getAttachmentSecureURL')) { |
|
| 191 | $this->content = str_replace($attachmentURL, '<img src="'.$this->BO->getAttachmentSecureURL($fileName).'">', $this->content); |
|
| 192 | } |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||
| 196 | $this->pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); |
|
| 197 | $this->pdf->SetCreator(PDF_CREATOR); |
|
| @@ 136-163 (lines=28) @@ | ||
| 133 | $attachments = array(); |
|
| 134 | preg_match_all('/\<img\ src\=\"\$attachURL\/.*\".*\>/', $this->content, $attachments); |
|
| 135 | ||
| 136 | foreach ($attachments[0] as $attachmentURL) { |
|
| 137 | $start = mb_strpos($attachmentURL, '/'); |
|
| 138 | $end = mb_strrpos($attachmentURL, '" alt'); |
|
| 139 | $fileName = mb_substr($attachmentURL, $start + 1, $end - ($start + 1)); |
|
| 140 | ||
| 141 | if ($config->get('cms.images.widget')) { |
|
| 142 | // get the details of the source image |
|
| 143 | $path = $this->BO->getAttachmentsLocation().'/'.$fileName; |
|
| 144 | $image_details = getimagesize($path); |
|
| 145 | $imgType = $image_details[2]; |
|
| 146 | if ($imgType == 1) { |
|
| 147 | $type = 'gif'; |
|
| 148 | } elseif ($imgType == 2) { |
|
| 149 | $type = 'jpg'; |
|
| 150 | } elseif ($imgType == 3) { |
|
| 151 | $type = 'png'; |
|
| 152 | } |
|
| 153 | ||
| 154 | $img = new Image($path, $image_details[0], $image_details[1], $type, 0.95, false, (boolean) $config->get('cms.images.widget.secure')); |
|
| 155 | ||
| 156 | $this->content = str_replace($attachmentURL, $img->renderHTMLLink(), $this->content); |
|
| 157 | } else { |
|
| 158 | // render a normal image link to the ViewAttachment controller |
|
| 159 | if (method_exists($this->BO, 'getAttachmentSecureURL')) { |
|
| 160 | $this->content = str_replace($attachmentURL, '<img src="'.$this->BO->getAttachmentSecureURL($fileName).'">', $this->content); |
|
| 161 | } |
|
| 162 | } |
|
| 163 | } |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|