Page 1 of 1

[Feature] Title under image

Posted: 23 Jan 2011, 21:40
by F@re
Hi,

Based on 'Simple HTML DOM Parser' that I mentioned in other topic comes my other idea for improvement of this great plug-in.

Basically idea is using alt tag in img to render title in pdf under image. There are plug-ins for rendering this tag in joomla articles so I think it would be great if there is possibility to have this also in pdf.

Again you need to include simple_html_dom.php.

My modification

Code: Select all

		if ($content->display_image == 0) {
			$pattern 		= '/<img(.*)>/Ui';
			$replacement 	= '';
			$documentOutput = preg_replace($pattern, $replacement, $documentOutput);
		}
		
		$html = str_get_html($documentOutput);
		$internal_style_p = ' style="color:' . 'rgb(104, 144, 72)' .
				';font-size:' . '8' . 'pt' .
				';font-weight:' . 'normal' .
				';font-style:' . 'normal' .
				';text-align:' . 'left' .
				';padding:' . '4' . "px " . '8' . "px" .
				';line-height:normal;margin:0px"';
		//Looking for all <img> elements
		foreach($html->find('img') as $e)
		{
			if($e->alt)
			{
				$e->outertext = $e->outertext . '<br /><span' . $internal_style_p . '>' . $e->alt . '</span><br />';							
			}
		}
		$documentOutput = $html;
		unset($html);		
		
		// Build the PDF Document string from the document buffer
		$pdf->writeHTML($documentOutput , true);
Of course in this case style of text is hard coded but I believe that I would be no problem to introduce styling options via GUI. Also possibility is to add selecting postion of text(top/bottom).

I hope that this feature would be useful and if there is enough interest it would get implemented in future releases.

Re: [Feature] Title under image

Posted: 24 Jan 2011, 17:30
by Jan
Hi, thank you for this guide.

In next version, which is under Joomla! 1.6 the system plugin was changed to content plugin as there is nothing to search and replace (Joomla! 1.6 does not have PDF feature), but will be great for using it in 1.5

Jan