Back to MediaHelper class

Method getCleanMediaFieldValue

public static string
getCleanMediaFieldValue
(mixed $value)
Helper method get clean data for value stores in a Media form field by removing adapter information from the value if available (in this case, the value will have this format: images/headers/blue-flower.jpg#joomlaImage://local-images/headers/blue-flower.jpg?width=700&height=180)
Parameters
  • string $value
Returns
  • string
Since
  • 4.0.0
Class: MediaHelper
Project: Joomla

Method getCleanMediaFieldValue - Source code

/**
 * Helper method get clean data for value stores in a Media form field by removing adapter information
 * from the value if available (in this case, the value will have this format:
 * images/headers/blue-flower.jpg#joomlaImage://local-images/headers/blue-flower.jpg?width=700&height=180)
 *
 * @param   string  $value
 *
 * @return  string
 *
 * @since   4.0.0
 */
public static function getCleanMediaFieldValue($value)
{
    if ($pos = strpos($value, '#')) {
        return substr($value, 0, $pos);
    }
    return $value;
}