Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#9811 removed invalid method setCoverImage from ContextService class #1546

Open
wants to merge 1 commit into
base: stable-3_3_0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 13 additions & 24 deletions classes/services/ContextService.inc.php
Expand Up @@ -185,7 +185,7 @@ public function resizeCoverThumbnails($context, $maxWidth, $maxHeight) {
\DAORegistry::getDAO('SeriesDAO'),
\DAORegistry::getDAO('SubmissionDAO'),
];
foreach ($objectDaos as $objectDao) {
foreach ($objectDaos as $objectDao) { /** @var CategoryDAO|SeriesDAO|SubmissionDAO $objectDao */
$objects = $objectDao->getByContextId($context->getId());
while ($object = $objects->next()) {
if (is_a($object, 'Submission')) {
Expand Down Expand Up @@ -243,29 +243,18 @@ public function resizeCoverThumbnails($context, $maxWidth, $maxHeight) {
}

imagedestroy($thumbnail);
if (is_a($object, 'Submission')) {
$object->setCoverImage(array(
'name' => $cover['name'],
'width' => $cover['width'],
'height' => $cover['height'],
'thumbnailName' => $cover['thumbnailName'],
'thumbnailWidth' => $thumbnailWidth,
'thumbnailHeight' => $thumbnailHeight,
'uploadName' => $cover['uploadName'],
'dateUploaded' => $cover['dateUploaded'],
));
} else {
$object->setImage(array(
'name' => $cover['name'],
'width' => $cover['width'],
'height' => $cover['height'],
'thumbnailName' => $cover['thumbnailName'],
'thumbnailWidth' => $thumbnailWidth,
'thumbnailHeight' => $thumbnailHeight,
'uploadName' => $cover['uploadName'],
'dateUploaded' => $cover['dateUploaded'],
));
}

$object->setImage(array(
'name' => $cover['name'],
'width' => $cover['width'],
'height' => $cover['height'],
'thumbnailName' => $cover['thumbnailName'],
'thumbnailWidth' => $thumbnailWidth,
'thumbnailHeight' => $thumbnailHeight,
'uploadName' => $cover['uploadName'],
'dateUploaded' => $cover['dateUploaded'],
));

// Update category object to store new thumbnail information.
$objectDao->updateObject($object);
}
Expand Down