0

I am trying to use the Joomla image class (use Joomla\CMS\Image\Image) in a com_fields field layout override.

$image = new Image($image);

gives me the following error message:

0 Object of class Joomla\CMS\Image\Image could not be converted to string

The image path is correct, as the following message appears when this is changed

0 The image file does not exist.

Is this a Joomla core bug or is something else missing?

1 Answer 1

1

You already have a property defined called $image that you are passing into the creation of a new Image object that is also called $image. I would assume the first definition of $image is a type of string and you are trying to update it with a type of object, hence the attempt to convert it to a string.

I think you need to change one of the $image properties to something else avoid the conflict.

$image_obj = new Image($image);
1
  • Thanks a lot. This took me the whole weekend, since it has been changed since Joomla 3 ;-) Commented Jul 1 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.