Image support - HELIX3 blog options - featured image and post formats

Presale questions & requests related to RAXO modules
rafaeltribos
Posts: 3
Joined: Aug 07, 2015 11:15 pm

Re: Image support - HELIX3 blog options - featured image and post formats

Post by rafaeltribos »

I studied the way the MSENA user instructed and, studying the source and phpMyAdmin,
I managed to make Raxo consume data from Helix's Blog Media.

Follow the code changes in the RaxoAllModeProHelper.php file:

Code: Select all

		if ($show_text || ($show_image && ($image_source === 'text' || $image_source === 'automatic'))) {
			$query->select(' a.introtext, a.fulltext, a.attribs');
		}

		$show_image && $image_source != 'text' ? $query->select(' a.images, a.attribs') : '';
a.attribs added

Code: Select all

			$empty = [
				'id', 'title', 'title_full', 'link', 'date', 'author',
				'image', 'image_thumbnail', 'image_original', 'image_alt', 'image_title', 'image_attributes',
				'category', 'category_id', 'category_name', 'category_link', 'featured',
				'text', 'readmore', 'hits', 'rating', 'rating_value', 'rating_count',
				'comments', 'comments_count', 'comments_link', 'attribs'
			];
'attribs' added

Code: Select all

					// Retrieve Image
					$img	= array_fill_keys(['src', 'alt', 'ttl'], '');
					$images = ($image_source != 'text') ? json_decode($item->attribs) : '';

					if (
						!empty($images->helix_ultimate_image) &&
						($image_source === 'intro' || $image_source === 'automatic')
					) {
						$img['src'] = HTMLHelper::cleanImageURL($images->helix_ultimate_image)->url;
						$img['alt'] = htmlspecialchars($images->image_alt, ENT_COMPAT, 'UTF-8');
						$img['ttl'] = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8');
					} ...
replaced Joomla article image extraction with Helix image extraction

These changes are compatible with RAXO All-mode PRO version 2.05
Admin
Site Admin
Posts: 1628
Joined: Jan 31, 2010 9:53 pm
Joomla! version: 5.3.3
PHP version: 8.3

Re: Image support - HELIX3 blog options - featured image and post formats

Post by Admin »

rafaeltribos wrote: Feb 14, 2025 3:15 am I managed to make Raxo consume data from Helix's Blog Media.

Follow the code changes in the RaxoAllModeProHelper.php file:

These changes are compatible with RAXO All-mode PRO version 2.05
Thank you very much for your work.

I edited your post to leave the necessary changes in the code, instead of posting the entire file. This will allow users to use these changes on other versions of the module, including future ones.
Admin
Site Admin
Posts: 1628
Joined: Jan 31, 2010 9:53 pm
Joomla! version: 5.3.3
PHP version: 8.3

Re: Image support - HELIX3 blog options - featured image and post formats

Post by Admin »

Due to significant code changes in the new module versions, we've decided to update these instructions.
Follow the code changes in the ContentHelper.php file:

1. Let's add the a.attribs field to the selection

Code: Select all

		// Selecting columns for images
		if ($this->O['show_image']) {
			if ($this->O['image_source'] !== 'text') {
				$columns[] = $db->qn('a.images');
				$columns[] = $db->qn('a.attribs');
			}
			if (\in_array($this->O['image_source'], ['text', 'automatic'])) {
				$columns['introtext'] = $db->qn('a.introtext');
				$columns[] = $db->qn('a.fulltext');
				$columns[] = $db->qn('a.attribs');
			}
		}
2. We will also add another field 'attribs' to the article.

Code: Select all

		// Item predefined fields
		$fields = array_fill_keys([
			'id', 'title', 'title_full', 'text', 'link', 'date', 'author', 'featured', 'image',
			'image_thumbnail', 'image_original', 'image_alt', 'image_title', 'image_attributes',
			'readmore', 'readmore_text', 'hits', 'rating', 'rating_value', 'rating_count',
			'category', 'category_id', 'category_name', 'category_link',
			'comments', 'comments_count', 'comments_link', 'attribs'
		], '');
3. Add Helix image extraction

Code: Select all

		// Get images from article fields
		if ($this->O['image_source'] !== 'text') {
			$images = json_decode($item->attribs);
		}
		
		...
		
		// Check one more image source
		elseif (
				!empty($images->helix_ultimate_image) &&
				\in_array($this->O['image_source'], ['intro', 'automatic'])
			) {
				$img['src'] = HTMLHelper::cleanImageURL($images->helix_ultimate_image)->url;
				$img['alt'] = htmlspecialchars($images->image_alt, ENT_COMPAT, 'UTF-8');
				$img['ttl'] = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8');
			}
		

You make these changes at your own risk. They require additional testing.
Therefore, it's essential to have a backup copy before making any changes to the files.
Post Reply