CoreFiles by mySites.guru
media.php42 lines, 802 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
b0f02371bf2180c69d7c8f788845bf9c
sha1
2517c2a8596fd41b2b85bfc1871b6587ebacbb8f
sha256
8606f0cc38df31609c8ba3aaa20872241ef6af3a072780c85e9e0f155d0ff758
<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Media
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

if ($field->value == '')
{
	return;
}

$class = $fieldParams->get('image_class');

if ($class)
{
	$class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}

$value  = $field->value;

$buffer = '';

if ($value)
{
	$path = $value['imagefile'];
	$alt = ' alt="' . htmlentities($value['alt_text'], ENT_COMPAT, 'UTF-8', true) . '"';

	if (file_exists($path))
	{
		$buffer .= sprintf('<img loading="lazy" src="%s"%s%s>',
			htmlentities($path, ENT_COMPAT, 'UTF-8', true),
			$class,
			$alt
		);
	}
}

echo $buffer;

The same content is in 3 releases, Joomla 4.0.0-beta3 to 4.0.0-beta5. See them all, or every version of this file.