CoreFiles by mySites.guru
media.php41 lines, 804 bytes, from Joomla_4.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta
md5
c546264e2faa65bf82e01e8c48f0b6a0
sha1
85fe83e71fa1b8a2eda8df56a27d19bb57003e08
sha256
7d44effcac17dd6346031c23bcf3fca56793e38c865225504a2026677d9356c4
<?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->apivalue;
$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 2 releases, Joomla 4.0.0-beta to 4.0.0-beta2. See them all, or every version of this file.