Unverified Commit 65856307 authored by larowlan's avatar larowlan

Issue #2931709 by marcoscano, claudiu.cristea: Wrong constant name in...

Issue #2931709 by marcoscano, claudiu.cristea: Wrong constant name in \Drupal\image\Plugin\Field\FieldType\ImageItem::generateSampleValue()
parent 984a2684
...@@ -344,7 +344,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin ...@@ -344,7 +344,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
if (!isset($images[$extension][$min_resolution][$max_resolution]) || count($images[$extension][$min_resolution][$max_resolution]) <= 5) { if (!isset($images[$extension][$min_resolution][$max_resolution]) || count($images[$extension][$min_resolution][$max_resolution]) <= 5) {
$tmp_file = drupal_tempnam('temporary://', 'generateImage_'); $tmp_file = drupal_tempnam('temporary://', 'generateImage_');
$destination = $tmp_file . '.' . $extension; $destination = $tmp_file . '.' . $extension;
file_unmanaged_move($tmp_file, $destination, FILE_CREATE_DIRECTORY); file_unmanaged_move($tmp_file, $destination);
if ($path = $random->image(\Drupal::service('file_system')->realpath($destination), $min_resolution, $max_resolution)) { if ($path = $random->image(\Drupal::service('file_system')->realpath($destination), $min_resolution, $max_resolution)) {
$image = File::create(); $image = File::create();
$image->setFileUri($path); $image->setFileUri($path);
...@@ -354,7 +354,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin ...@@ -354,7 +354,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin
$destination_dir = static::doGetUploadLocation($settings); $destination_dir = static::doGetUploadLocation($settings);
file_prepare_directory($destination_dir, FILE_CREATE_DIRECTORY); file_prepare_directory($destination_dir, FILE_CREATE_DIRECTORY);
$destination = $destination_dir . '/' . basename($path); $destination = $destination_dir . '/' . basename($path);
$file = file_move($image, $destination, FILE_CREATE_DIRECTORY); $file = file_move($image, $destination);
$images[$extension][$min_resolution][$max_resolution][$file->id()] = $file; $images[$extension][$min_resolution][$max_resolution][$file->id()] = $file;
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment