|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
[TYPO3-english] GifbuilderDoes gif builder convert whatever source images it uses first to a gif, before then saving it in the 'format' specified? Fort a site I'm making, all tt_news images must have grey borders with round corners. To achieve this I have used an image processing script like the one below. It does everything I need. It sizes the images and makes a greyborder with round corners, and within the border is the article's image. What it also does it make the outputed image look shite. It must be a something gifbuilder is doing to the image before saving as png. Is there anyway that I can do this without the image quality being ruined? Is there away maybe of combining the original image with a gifbuilder image (of the border and mask) rather then making teh original also a part of the gifbuilder? <?php /*************************************************************** * Copyright notice * * (c) 1999-2004 Kasper Skaarhoj (kasper@...) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt and important notices to the license * from the author is found in LICENSE.txt distributed with these scripts. * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ function user_fmfV2ImageProcessor($paramArray, $conf) { $markerArray = $paramArray[0]; $lConf = $paramArray[1]; $pObj = &$conf['parentObj']; // make a reference to the parent-object $row = $pObj->local_cObj->data; $picWidthList = '147'; $picHeightList = $picWidthList; $picWidthLatest = '469'; $picHeightLatest = '314'; $picFilePath = 'uploads/pics/'; $picBasePath = 'fileadmin/templates/fmf/v2/images/'; $imageNum = isset($lConf['imageCount']) ? $lConf['imageCount']:1; $imageNum = t3lib_div::intInRange($imageNum, 0, 100); $theImgCode = ''; $imgs = t3lib_div::trimExplode(',', $row['image'], 1); $imgsCaptions = explode(chr(10), $row['imagecaption']); $imgsAltTexts = explode(chr(10), $row['imagealttext']); $imgsTitleTexts = explode(chr(10), $row['imagetitletext']); reset($imgs); $cc = 0; $whatToDisplay = $pObj->cObj->data['pi_flexform']['data']['sDEF']['lDEF']['what_to_display']['vDEF']; // Not tested with multiple image articles if ($whatToDisplay == 'SINGLE') { // remove first img from the image array in single view if the TSvar firstImageIsPreview is set if (( (count($imgs) > 1 && $pObj->config['firstImageIsPreview']) || (count($imgs) >= 1 && $pObj->config['forceFirstImageIsPreview']))) { array_shift($imgs); array_shift($imgsCaptions); array_shift($imgsAltTexts); array_shift($imgsTitleTexts); } // get img array parts for single view pages if ($pObj->piVars[$pObj->config['singleViewPointerName']]) { $spage = $pObj->piVars[$pObj->config['singleViewPointerName']]; $astart = $imageNum*$spage; $imgs = array_slice($imgs,$astart,$imageNum); $imgsCaptions = array_slice($imgsCaptions,$astart,$imageNum); $imgsAltTexts = array_slice($imgsAltTexts,$astart,$imageNum); $imgsTitleTexts = array_slice($imgsTitleTexts,$astart,$imageNum); } // Still to do... // SINGLE page articles don't have images in V2. May need to later handle images for SINGLE if this changes. } if ($whatToDisplay == 'LIST' || $whatToDisplay == 'SEARCH') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = 'GIFBUILDER'; $lConf['image.']['file.']['XY'] = $picWidthList . ',' . $picHeightList; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '80'; $lConf['image.']['file.']['10'] = 'IMAGE'; $lConf['image.']['file.']['10.']['file'] = $picFilePath . $val; $lConf['image.']['file.']['10.']['file.']['minW'] = $picWidthList; $lConf['image.']['file.']['10.']['file.']['minH'] = $picHeightList; $lConf['image.']['file.']['10.']['file.']['XY'] = $picWidthList . ',' . $picHeightList; $lConf['image.']['file.']['10.']['file.']['width'] = $picWidthList . 'c'; $lConf['image.']['file.']['10.']['file.']['height'] = $picHeightList . 'c'; $lConf['image.']['file.']['20'] = 'IMAGE'; $lConf['image.']['file.']['20.']['file'] = $picBasePath . 'art_small.gif'; $lConf['image.']['file.']['20.']['file.']['minW'] = $picWidthList; $lConf['image.']['file.']['20.']['file.']['minH'] = $picHeightList; $lConf['image.']['file.']['20.']['file.']['XY'] = $picWidthList . ',' . $picHeightList; $lConf['image.']['file.']['20.']['file.']['width'] = $picWidthList . 'c'; $lConf['image.']['file.']['20.']['file.']['height'] = $picHeightList . 'c'; $lConf['image.']['file.']['20.']['mask'] = $picBasePath . 'art_small_mask3.gif'; $lConf['image.']['file.']['20.']['mask.']['minW'] = $picWidthList; $lConf['image.']['file.']['20.']['mask.']['minH'] = $picHeightList; $lConf['image.']['file.']['20.']['mask.']['XY'] = $picWidthList . ',' . $picHeightList; $lConf['image.']['file.']['20.']['mask.']['width'] = $picWidthList . 'c'; $lConf['image.']['file.']['20.']['mask.']['height'] = $picHeightList . 'c'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } else if ($whatToDisplay == 'LATEST') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = 'GIFBUILDER'; $lConf['image.']['file.']['XY'] = $picWidthLatest . ',' . $picHeightLatest; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '80'; $lConf['image.']['file.']['10'] = 'IMAGE'; $lConf['image.']['file.']['10.']['file'] = $picFilePath . $val; $lConf['image.']['file.']['10.']['file.']['minW'] = $picWidthLatest; $lConf['image.']['file.']['10.']['file.']['minH'] = $picHeightLatest; $lConf['image.']['file.']['10.']['file.']['XY'] = $picWidthLatest . ',' . $picHeightLatest; $lConf['image.']['file.']['10.']['file.']['width'] = $picWidthLatest . 'c'; $lConf['image.']['file.']['10.']['file.']['height'] = $picHeightLatest . 'c'; $lConf['image.']['file.']['20'] = 'IMAGE'; $lConf['image.']['file.']['20.']['file'] = $picBasePath . 'art_large.jpg'; $lConf['image.']['file.']['20.']['file.']['minW'] = $picWidthLatest; $lConf['image.']['file.']['20.']['file.']['minH'] = $picHeightLatest; $lConf['image.']['file.']['20.']['file.']['XY'] = $picWidthLatest . ',' . $picHeightLatest; $lConf['image.']['file.']['20.']['file.']['width'] = $picWidthLatest . 'c'; $lConf['image.']['file.']['20.']['file.']['height'] = $picHeightLatest . 'c'; $lConf['image.']['file.']['20.']['mask'] = $picBasePath . 'article_large_mask3.png'; $lConf['image.']['file.']['20.']['mask.']['minW'] = $picWidthLatest; $lConf['image.']['file.']['20.']['mask.']['minH'] = $picHeightLatest; $lConf['image.']['file.']['20.']['mask.']['XY'] = $picWidthLatest . ',' . $picHeightLatest; $lConf['image.']['file.']['20.']['mask.']['width'] = $picWidthLatest . 'c'; $lConf['image.']['file.']['20.']['mask.']['height'] = $picHeightLatest . 'c'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } $markerArray['###NEWS_IMAGE###'] = ''; if ($cc) { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']); } else { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->stdWrap($markerArray['###NEWS_IMAGE###'],$lConf['image.']['noImage_stdWrap.']); } return $markerArray; } ?> ----- -- Stephen Bungert -- View this message in context: http://www.nabble.com/Gifbuilder-tp19898169p19898169.html Sent from the TYPO3 English mailing list archive at Nabble.com. _______________________________________________ TYPO3-english mailing list TYPO3-english@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english --
Stephen Bungert |
|
|
Re: [TYPO3-english] GifbuilderI tried making jpg images, but whatever I set the quality to, there is no change in the images appearence. I put the quality element here: $lConf['image.']['file.']. That's the right place, isn't it? I ask because specifying gif as the output and setting reduceColors to something so low that I would expect to be able to see a difference also produced no noticable change. ----- -- Stephen Bungert -- View this message in context: http://www.nabble.com/-TYPO3-english--Gifbuilder-tp19898191p19898286.html Sent from the TYPO3 English mailing list archive at Nabble.com. _______________________________________________ TYPO3-english mailing list TYPO3-english@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english --
Stephen Bungert |
|
|
Re: [TYPO3-english] GifbuilderI tried making jpg images, but whatever I set the quality to, there is no change in the images appearence.
I put the quality element here: $lConf['image.']['file.']. That's the right place, isn't it? I ask because specifying gif as the output and setting reduceColors to something so low that I would expect to be able to see a difference also produced no noticable change. --
Stephen Bungert |
|
|
|
|
|
Re: [TYPO3-english] GifbuilderMaybe... http://bugs.typo3.org/view.php?id=7194
Tomas Mrozek _______________________________________________ TYPO3-english mailing list TYPO3-english@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english |
|
|
Re: [TYPO3-english] GifbuilderThanks both for your help. I think to get those problems fixed would mean upgrading which we don't have time for. However I have a solution that works.
Here is my new script: <?php /*************************************************************** * Copyright notice * * (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt and important notices to the license * from the author is found in LICENSE.txt distributed with these scripts. * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ function user_fmfV2ImageProcessor($paramArray, $conf) { $markerArray = $paramArray[0]; $lConf = $paramArray[1]; $pObj = &$conf['parentObj']; // make a reference to the parent-object $row = $pObj->local_cObj->data; $picWidthList = '147'; $picHeightList = $picWidthList; $picWidthLatest = '469'; $picHeightLatest = '314'; $picFilePath = 'uploads/pics/'; $picBasePath = 'fileadmin/templates/fmf/v2/images/'; $imageNum = isset($lConf['imageCount']) ? $lConf['imageCount']:1; $imageNum = t3lib_div::intInRange($imageNum, 0, 100); $theImgCode = ''; $imgs = t3lib_div::trimExplode(',', $row['image'], 1); $imgsCaptions = explode(chr(10), $row['imagecaption']); $imgsAltTexts = explode(chr(10), $row['imagealttext']); $imgsTitleTexts = explode(chr(10), $row['imagetitletext']); reset($imgs); $cc = 0; $whatToDisplay = $pObj->cObj->data['pi_flexform']['data']['sDEF']['lDEF']['what_to_display']['vDEF']; if ($whatToDisplay == 'SINGLE') { // remove first img from the image array in single view if the TSvar firstImageIsPreview is set if (( (count($imgs) > 1 && $pObj->config['firstImageIsPreview']) || (count($imgs) >= 1 && $pObj->config['forceFirstImageIsPreview']))) { array_shift($imgs); array_shift($imgsCaptions); array_shift($imgsAltTexts); array_shift($imgsTitleTexts); } // get img array parts for single view pages if ($pObj->piVars[$pObj->config['singleViewPointerName']]) { $spage = $pObj->piVars[$pObj->config['singleViewPointerName']]; $astart = $imageNum*$spage; $imgs = array_slice($imgs,$astart,$imageNum); $imgsCaptions = array_slice($imgsCaptions,$astart,$imageNum); $imgsAltTexts = array_slice($imgsAltTexts,$astart,$imageNum); $imgsTitleTexts = array_slice($imgsTitleTexts,$astart,$imageNum); } // Still to do... // SINGLE page articles don't have images in V2. May need to later handle images for SINGLE if this changes. } if ($whatToDisplay == 'LIST' || $whatToDisplay == 'SEARCH') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = $picBasePath . 'art_small.gif'; $lConf['image.']['file.']['m.']['mask'] = $picBasePath . 'art_small_mask3.gif'; $lConf['image.']['file.']['m.']['bgImg'] = $picFilePath . $val; $lConf['image.']['file.']['m.']['bgImg.']['width'] = $picWidthList . 'c'; $lConf['image.']['file.']['m.']['bgImg.']['height'] = $picHeightList . 'c'; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '90'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } else if ($whatToDisplay == 'LATEST') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = $picBasePath . 'art_large.jpg'; $lConf['image.']['file.']['m.']['mask'] = $picBasePath . 'article_large_mask3.png'; $lConf['image.']['file.']['m.']['bgImg'] = $picFilePath . $val; $lConf['image.']['file.']['m.']['bgImg.']['width'] = $picWidthLatest . 'c'; $lConf['image.']['file.']['m.']['bgImg.']['height'] = $picHeightLatest . 'c'; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '90'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } $markerArray['###NEWS_IMAGE###'] = ''; if ($cc) { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']); } else { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->stdWrap($markerArray['###NEWS_IMAGE###'],$lConf['image.']['noImage_stdWrap.']); } return $markerArray; } ?> It doesn't use GIFBUILDER so the image quality is great. The only problem I hhad was that the article image (the background image now, was scaled to fit the foreground image - the border. After experimenting I have found how to scale the background image (the articles image) so that it doesn't get squashed to the size of the imageResource. See the above code to see how. It is not finished. I need to test it with articles with multiple images and see what would happen, as we only want one image in the list view. Thanks again! --
Stephen Bungert |
|
|
Re: [TYPO3-english] GifbuilderThanks both for your help. I think to get those problems fixed would mean upgrading which we don't have time for. However I have a solution that works. Here is my new script: <?php /*************************************************************** * Copyright notice * * (c) 1999-2004 Kasper Skaarhoj (kasper@...) * All rights reserved * * This script is part of the TYPO3 project. The TYPO3 project is * free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * The GNU General Public License can be found at * http://www.gnu.org/copyleft/gpl.html. * A copy is found in the textfile GPL.txt and important notices to the license * from the author is found in LICENSE.txt distributed with these scripts. * * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ function user_fmfV2ImageProcessor($paramArray, $conf) { $markerArray = $paramArray[0]; $lConf = $paramArray[1]; $pObj = &$conf['parentObj']; // make a reference to the parent-object $row = $pObj->local_cObj->data; $picWidthList = '147'; $picHeightList = $picWidthList; $picWidthLatest = '469'; $picHeightLatest = '314'; $picFilePath = 'uploads/pics/'; $picBasePath = 'fileadmin/templates/fmf/v2/images/'; $imageNum = isset($lConf['imageCount']) ? $lConf['imageCount']:1; $imageNum = t3lib_div::intInRange($imageNum, 0, 100); $theImgCode = ''; $imgs = t3lib_div::trimExplode(',', $row['image'], 1); $imgsCaptions = explode(chr(10), $row['imagecaption']); $imgsAltTexts = explode(chr(10), $row['imagealttext']); $imgsTitleTexts = explode(chr(10), $row['imagetitletext']); reset($imgs); $cc = 0; $whatToDisplay = $pObj->cObj->data['pi_flexform']['data']['sDEF']['lDEF']['what_to_display']['vDEF']; if ($whatToDisplay == 'SINGLE') { // remove first img from the image array in single view if the TSvar firstImageIsPreview is set if (( (count($imgs) > 1 && $pObj->config['firstImageIsPreview']) || (count($imgs) >= 1 && $pObj->config['forceFirstImageIsPreview']))) { array_shift($imgs); array_shift($imgsCaptions); array_shift($imgsAltTexts); array_shift($imgsTitleTexts); } // get img array parts for single view pages if ($pObj->piVars[$pObj->config['singleViewPointerName']]) { $spage = $pObj->piVars[$pObj->config['singleViewPointerName']]; $astart = $imageNum*$spage; $imgs = array_slice($imgs,$astart,$imageNum); $imgsCaptions = array_slice($imgsCaptions,$astart,$imageNum); $imgsAltTexts = array_slice($imgsAltTexts,$astart,$imageNum); $imgsTitleTexts = array_slice($imgsTitleTexts,$astart,$imageNum); } // Still to do... // SINGLE page articles don't have images in V2. May need to later handle images for SINGLE if this changes. } if ($whatToDisplay == 'LIST' || $whatToDisplay == 'SEARCH') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = $picBasePath . 'art_small.gif'; $lConf['image.']['file.']['m.']['mask'] = $picBasePath . 'art_small_mask3.gif'; $lConf['image.']['file.']['m.']['bgImg'] = $picFilePath . $val; $lConf['image.']['file.']['m.']['bgImg.']['width'] = $picWidthList . 'c'; $lConf['image.']['file.']['m.']['bgImg.']['height'] = $picHeightList . 'c'; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '90'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } else if ($whatToDisplay == 'LATEST') { while (list(, $val) = each($imgs)) { if ($cc == $imageNum) break; if ($val) { $lConf['image.']['file'] = $picBasePath . 'art_large.jpg'; $lConf['image.']['file.']['m.']['mask'] = $picBasePath . 'article_large_mask3.png'; $lConf['image.']['file.']['m.']['bgImg'] = $picFilePath . $val; $lConf['image.']['file.']['m.']['bgImg.']['width'] = $picWidthLatest . 'c'; $lConf['image.']['file.']['m.']['bgImg.']['height'] = $picHeightLatest . 'c'; $lConf['image.']['file.']['format'] = 'jpg'; $lConf['image.']['file.']['quality'] = '90'; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; $lConf['image.']['altText'] = $imgsAltTexts[$cc]; $lConf['image.']['titleText'] = $imgsTitleTexts[$cc]; } $theImgCode .= $pObj->local_cObj->IMAGE($lConf['image.']) . $pObj->local_cObj->stdWrap($imgsCaptions[$cc], $lConf['caption_stdWrap.']); $cc++; unset($imgs[0]); } } $markerArray['###NEWS_IMAGE###'] = ''; if ($cc) { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->wrap(trim($theImgCode), $lConf['imageWrapIfAny']); } else { $markerArray['###NEWS_IMAGE###'] = $pObj->local_cObj->stdWrap($markerArray['###NEWS_IMAGE###'],$lConf['image.']['noImage_stdWrap.']); } return $markerArray; } ?> It doesn't use GIFBUILDER so the image quality is great. The only problem I hhad was that the article image (the background image now, was scaled to fit the foreground image - the border. After experimenting I have found how to scale the background image (the articles image) so that it doesn't get squashed to the size of the imageResource. See the above code to see how. It is not finished. I need to test it with articles with multiple images and see what would happen, as we only want one image in the list view. Thanks again! ----- -- Stephen Bungert -- View this message in context: http://www.nabble.com/-TYPO3-english--Gifbuilder-tp19898191p19920727.html Sent from the TYPO3 English mailing list archive at Nabble.com. _______________________________________________ TYPO3-english mailing list TYPO3-english@... http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english --
Stephen Bungert |
| Free Forum Powered by Nabble | Forum Help |