Public Member Functions | |
| init () | |
| Init function, setting the input vars in the global space. | |
| main () | |
| Main function which creates the image if needed and outputs the HTML code for the page displaying the image. | |
| printContent () | |
| Outputs the content from $this->content. | |
Public Attributes | |
| $content | |
| $file | |
| $width | |
| $height | |
| $sample | |
| $alternativeTempPath | |
| $effects | |
| $frame | |
| $bodyTag | |
| $title | |
| $wrap | |
| $md5 | |
|
|
Init function, setting the input vars in the global space.
Definition at line 118 of file showpic.php. 00118 {
00119 // Loading internal vars with the GET/POST parameters from outside:
00120 $this->file = t3lib_div::_GP('file');
00121 $this->width = t3lib_div::_GP('width');
00122 $this->height = t3lib_div::_GP('height');
00123 $this->sample = t3lib_div::_GP('sample');
00124 $this->alternativeTempPath = t3lib_div::_GP('alternativeTempPath');
00125 $this->effects = t3lib_div::_GP('effects');
00126 $this->frame = t3lib_div::_GP('frame');
00127 $this->bodyTag = t3lib_div::_GP('bodyTag');
00128 $this->title = t3lib_div::_GP('title');
00129 $this->wrap = t3lib_div::_GP('wrap');
00130 $this->md5 = t3lib_div::_GP('md5');
00131
00132 // ***********************
00133 // Check parameters
00134 // ***********************
00135 // If no file-param is given, we must exit
00136 if (!$this->file) {
00137 die('Parameter Error: No file given.');
00138 }
00139
00140 // Chech md5-checksum: If this md5-value does not match the one submitted, then we fail... (this is a kind of security that somebody don't just hit the script with a lot of different parameters
00141 $md5_value = md5($this->file.'|'.$this->width.'|'.$this->height.'|'.$this->effects.'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'].'|');
00142 if ($md5_value!=$this->md5) {
00143 die('Parameter Error: Wrong parameters sent.');
00144 }
00145
00146 // ***********************
00147 // Check the file. If must be in a directory beneath the dir of this script...
00148 // $this->file remains unchanged, because of the code in stdgraphic, but we do check if the file exists within the current path
00149 // ***********************
00150
00151 $test_file=PATH_site.$this->file;
00152 if (!t3lib_div::validPathStr($test_file)) {
00153 die('Parameter Error: No valid filepath');
00154 }
00155 if (!@is_file($test_file)) {
00156 die('The given file was not found');
00157 }
00158 }
|
|
|
Main function which creates the image if needed and outputs the HTML code for the page displaying the image. Accumulates the content in $this->content
Definition at line 166 of file showpic.php. References TYPO3_db_host, TYPO3_db_password, and TYPO3_db_username. 00166 {
00167
00168 // Creating stdGraphic object, initialize it and make image:
00169 $img = t3lib_div::makeInstance('t3lib_stdGraphic');
00170 $img->mayScaleUp = 0;
00171 $img->init();
00172 if ($this->sample) {$img->scalecmd = '-sample';}
00173 if ($this->alternativeTempPath && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['allowedTempPaths'],$this->alternativeTempPath)) {
00174 $img->tempPath = $this->alternativeTempPath;
00175 }
00176
00177 #if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['enable_typo3temp_db_tracking']) {
00178 // Need to connect to database, because this may be used (eg. by stdgraphic)
00179 $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password);
00180 #}
00181
00182 if (strstr($this->width.$this->height, 'm')) {$max='m';} else {$max='';}
00183
00184 $this->height = t3lib_div::intInRange($this->height,0,1000);
00185 $this->width = t3lib_div::intInRange($this->width,0,1000);
00186 if ($this->frame) {$this->frame = intval($this->frame);}
00187 $imgInfo = $img->imageMagickConvert($this->file,'web',$this->width.$max,$this->height,$img->IMparams($this->effects),$this->frame,'');
00188
00189
00190 // Create HTML output:
00191 $this->content='';
00192 $this->content.='
00193 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
00194
00195 <html>
00196 <head>
00197 <title>'.htmlspecialchars($this->title ? $this->title : "Image").'</title>
00198 </head>
00199 '.($this->bodyTag ? $this->bodyTag : '<body>');
00200
00201 if (is_array($imgInfo)) {
00202 $wrapParts = explode('|',$this->wrap);
00203 $this->content.=trim($wrapParts[0]).$img->imgTag($imgInfo).trim($wrapParts[1]);
00204 }
00205 $this->content.='
00206 </body>
00207 </html>';
00208 }
|
|
|
Outputs the content from $this->content.
Definition at line 215 of file showpic.php. 00215 {
00216 echo $this->content;
00217 }
|
|
|
Definition at line 105 of file showpic.php. |
|
|
Definition at line 108 of file showpic.php. |
|
|
Definition at line 98 of file showpic.php. |
|
|
Definition at line 106 of file showpic.php. |
|
|
Definition at line 101 of file showpic.php. |
|
|
Definition at line 107 of file showpic.php. |
|
|
Definition at line 103 of file showpic.php. |
|
|
Definition at line 111 of file showpic.php. |
|
|
Definition at line 104 of file showpic.php. |
|
|
Definition at line 109 of file showpic.php. |
|
|
Definition at line 102 of file showpic.php. |
|
|
Definition at line 110 of file showpic.php. |
1.3.8-20040913