eZ Platform Discussions

Upgrade from 1.9 - 2.3 incorrect image paths for translated constent objects field type ezimage


#1
  • After upgrading from 1.9 -> 2.3 some of the image paths are incorrect.
  • We have a simple content type “article” with a image field which is translatable.
  • The default language of the admin is English, with the majority of the content with a German translation.
  • Prior to the upgrade, we hit no issues regarding the field. Post upgrade on occasion the paths are calculated incorrectly.

The twig code in use to print the content:

  {% set headerImageContent = content.getField( 'header_image' )  %}
  {{ dumpAndDie(headerImageContent) }}

Dump and die is just:

public function dumpAndDie($dump)
{
    var_dump($dump);
    die();
}

On the new upgrade 2.3 code base:
The english translation prints:

object(eZ\Publish\API\Repository\Values\Content\Field)[2137]
  protected 'id' => int 1041
  protected 'fieldDefIdentifier' => string 'header_image' (length=12)
  protected 'value' => 
    object(eZ\Publish\Core\FieldType\Image\Value)[2146]
      public 'id' => string '1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg' (length=64)
      public 'alternativeText' => string 'Infrastructure Hero Image' (length=25)
      public 'fileName' => string 'infrastructure_ferdinand-stohr-186065.jpg' (length=41)
      public 'fileSize' => int 650912
      public 'uri' => string '/var/site/storage/images/1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg' (length=89)
      public 'imageId' => string '101-1041-27' (length=11)
      public 'inputUri' => null
      public 'width' => string '2000' (length=4)
      public 'height' => string '1100' (length=4)
  protected 'languageCode' => string 'eng-GB' (length=6)
  protected 'fieldTypeIdentifier' => string 'ezimage' (length=7)

The german translation prints:

object(eZ\Publish\API\Repository\Values\Content\Field)[14502]
  protected 'id' => int 1089
  protected 'fieldDefIdentifier' => string 'header_image' (length=12)
  protected 'value' => 
    object(eZ\Publish\Core\FieldType\Image\Value)[14503]
      public 'id' => string 'images/images/images/9/8/0/1/1089-14-ger-DE/infrastructure_ferdinand-stohr-186065.jpg' (length=85)
      public 'alternativeText' => string 'Hero Bild IT infrastruktur' (length=26)
      public 'fileName' => string 'infrastructure_ferdinand-stohr-186065.jpg' (length=41)
      public 'fileSize' => null
      public 'uri' => string '/var/site/storage/images-versioned/images/images/images/9/8/0/1/1089-14-ger-DE/infrastructure_ferdinand-stohr-186065.jpg' (length=120)
      public 'imageId' => string '101-1089-27' (length=11)
      public 'inputUri' => null
      public 'width' => string '2000' (length=4)
      public 'height' => string '1100' (length=4)
  protected 'languageCode' => string 'ger-DE' (length=6)
  protected 'fieldTypeIdentifier' => string 'ezimage' (length=7)

The problem is, the german translation file path does not exist. In fact, the subfolder “images_versioned” does not even exist :confused:

After the upgrade, the image is also not visible in the admin panel either. When inspecting element the image html is just:

<img src="//:0">

On the older 1.9 ezplatform code base:
The same content object and tpl code

The english translation prints:

object(eZ\Publish\API\Repository\Values\Content\Field)[3701]
protected ‘id’ => int 1041
protected ‘fieldDefIdentifier’ => string ‘header_image’ (length=12)
protected ‘value’ =>
object(eZ\Publish\Core\FieldType\Image\Value)[3705]
public ‘id’ => string ‘1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg’ (length=64)
public ‘alternativeText’ => string ‘Infrastructure Hero Image’ (length=25)
public ‘fileName’ => string ‘infrastructure_ferdinand-stohr-186065.jpg’ (length=41)
public ‘fileSize’ => int 650912
public ‘uri’ => string ‘/var/site/storage/images/1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg’ (length=89)
public ‘imageId’ => string ‘101-1041-27’ (length=11)
public ‘inputUri’ => null
public ‘width’ => string ‘2000’ (length=4)
public ‘height’ => string ‘1100’ (length=4)
protected ‘languageCode’ => string ‘eng-GB’ (length=6)

The german translation prints:

object(eZ\Publish\API\Repository\Values\Content\Field)[3605]
protected ‘id’ => int 1041
protected ‘fieldDefIdentifier’ => string ‘header_image’ (length=12)
protected ‘value’ =>
object(eZ\Publish\Core\FieldType\Image\Value)[3609]
public ‘id’ => string ‘1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg’ (length=64)
public ‘alternativeText’ => string ‘Infrastructure Hero Image’ (length=25)
public ‘fileName’ => string ‘infrastructure_ferdinand-stohr-186065.jpg’ (length=41)
public ‘fileSize’ => int 650912
public ‘uri’ => string ‘/var/site/storage/images/1/4/0/1/1041-27-eng-GB/infrastructure_ferdinand-stohr-186065.jpg’ (length=89)
public ‘imageId’ => string ‘101-1041-27’ (length=11)
public ‘inputUri’ => null
public ‘width’ => string ‘2000’ (length=4)
public ‘height’ => string ‘1100’ (length=4)
protected ‘languageCode’ => string ‘eng-GB’ (length=6)

Summary
Issue:
Prior to the upgrade, all image paths from content objects were fine.
Post upgrade, some of the paths have been changed somehow to a sub-directory that does not exist.

Temp hacky fix
I can find the content object in ez, and edit, reupload the image and publish. This fixes the image paths, but not great will take a long time and also looses the correct version history of the object.

Has anyone else seem this problem and found a resolution for it when upgrading?