Skip to content

Commit

Permalink
NBNP-448 Correct error in DZI copy helper
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSanford committed Jun 5, 2024
1 parent 5ed22d6 commit 04497e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions custom/modules/newspapers_core/newspapers_core.module
Original file line number Diff line number Diff line change
Expand Up @@ -1889,10 +1889,11 @@ function _newspapers_core_delete_image_dzi($page_id) {
->getStorage('digital_serial_page')
->load($page_id);
if (!empty($page)) {
$dzi_path = $page-> getDziUri();
if (!empty($dzi_path)) {
$dzi_uri = $page->getDziUri();
if (!empty($dzi_uri)) {
$file_system = \Drupal::service('file_system');
$abs_dzi_path = $file_system->realpath($dzi_path);
$abs_dzi_path = $file_system->realpath($dzi_uri);

if (!empty($abs_dzi_path)) {
if (file_exists($abs_dzi_path) && str_contains($abs_dzi_path, '.dzi')) {
unlink($abs_dzi_path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public static function moveIssuePages($issue) {
public static function moveDziTileLocation($page, $issue) {
$file = $page->getPageImage();
$issue_id = $issue->id();
$file_name = $file->getFilename();
$image_file_name = $file->getFilename();
$file_name = str_replace('.jpg', '.dzi', $image_file_name);

$old_page_absolute_file_location = "/app/html/sites/default/files/serials/pages/$file_name";
$new_page_absolute_file_location = "/app/html/sites/default/files/serials/pages/$issue_id/$file_name";
Expand Down

0 comments on commit 04497e1

Please sign in to comment.