summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2017-06-28 22:27:23 +0100
committerGreg Roach <fisharebest@gmail.com>2017-07-02 16:52:26 +0100
commitdce0740103e59b292d66e287384d4ab36cd3d614 (patch)
tree803c5cf720d411ab3432ebff5ce1085cf6c0c49b /app
parentfb4ca52d8e7416cef20f8a4ccda9a7daea6843e3 (diff)
downloadwebtrees-dce0740103e59b292d66e287384d4ab36cd3d614.tar.gz
webtrees-dce0740103e59b292d66e287384d4ab36cd3d614.tar.bz2
webtrees-dce0740103e59b292d66e287384d4ab36cd3d614.zip
Use glide/intervention to generate thumbnail images
Diffstat (limited to 'app')
-rw-r--r--app/Controller/CompactController.php2
-rw-r--r--app/Functions/FunctionsEdit.php4
-rw-r--r--app/Functions/FunctionsMedia.php57
-rw-r--r--app/Functions/FunctionsPrint.php5
-rw-r--r--app/Functions/FunctionsPrintFacts.php16
-rw-r--r--app/Functions/FunctionsPrintLists.php2
-rw-r--r--app/Individual.php15
-rw-r--r--app/Media.php176
-rw-r--r--app/Module/AlbumModule.php2
-rw-r--r--app/Module/GoogleMapsModule.php2
-rw-r--r--app/Module/InteractiveTree/TreeView.php2
-rw-r--r--app/Module/SlideShowModule.php2
-rw-r--r--app/Report/ReportPdf.php3
-rw-r--r--app/Theme/AbstractTheme.php6
14 files changed, 126 insertions, 168 deletions
diff --git a/app/Controller/CompactController.php b/app/Controller/CompactController.php
index 699d5ab162..832938d745 100644
--- a/app/Controller/CompactController.php
+++ b/app/Controller/CompactController.php
@@ -64,7 +64,7 @@ class CompactController extends ChartController {
$addname = $indi->getAddName();
if ($this->show_thumbs && $indi->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- $html = $indi->displayImage();
+ $html = $indi->displayImage(40, 50, 'crop', []);
} else {
$html = '';
}
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php
index 6216678bbf..c3cd701b5e 100644
--- a/app/Functions/FunctionsEdit.php
+++ b/app/Functions/FunctionsEdit.php
@@ -1481,7 +1481,7 @@ class FunctionsEdit {
$add_date = true;
// List of tags we would expect at the next level
- // NB add_missing_subtags() already takes care of the simple cases
+ // NB insertMissingSubtags() already takes care of the simple cases
// where a level 1 tag is missing a level 2 tag. Here we only need to
// handle the more complicated cases.
$expected_subtags = [
@@ -1673,7 +1673,7 @@ class FunctionsEdit {
}
}
// Do something (anything!) with unrecognized custom tags
- if (substr($level1tag, 0, 1) === '_' && $level1tag !== '_UID' && $level1tag !== '_TODO') {
+ if (substr($level1tag, 0, 1) === '_' && $level1tag !== '_UID' && $level1tag !== '_PRIM' && $level1tag !== '_TODO') {
foreach (['DATE', 'PLAC', 'ADDR', 'AGNC', 'TYPE', 'AGE'] as $tag) {
if (!in_array($tag, $tags)) {
self::addSimpleTag('2 ' . $tag);
diff --git a/app/Functions/FunctionsMedia.php b/app/Functions/FunctionsMedia.php
index e27f2aa0cf..90f9392786 100644
--- a/app/Functions/FunctionsMedia.php
+++ b/app/Functions/FunctionsMedia.php
@@ -49,49 +49,30 @@ class FunctionsMedia {
}
/**
- * Determine whether there is enough memory to load a particular image.
+ * Send a dummy image, where one could not be found or created.
*
- * @param string $serverFilename
- *
- * @return bool
+ * @param int $status HTTP status code, such as 404 for "Not found"
*/
- public static function hasMemoryForImage($serverFilename) {
- // find out how much total memory this script can access
- $memoryAvailable = self::sizeToBytes(ini_get('memory_limit'));
- // if memory is unlimited, it will return -1 and we don’t need to worry about it
- if ($memoryAvailable == -1) {
- return true;
- }
+ public static function outputHttpStatusAsImage($status, $message) {
+ $width = 100;
+ $height = 50;
+ $image = imagecreatetruecolor($width, $height);
+ $foreground = imagecolorallocate($image, 255, 0, 0);
+ $background = imagecolorallocate($image, 255, 255, 255);
- // find out how much memory we are already using
- $memoryUsed = memory_get_usage();
+ // Draw a border
+ imagefilledrectangle($image, 0, 0, $width, $height, $foreground);
+ imagefilledrectangle($image, 1, 1, $width - 2, $height - 2, $background);
- try {
- $imgsize = getimagesize($serverFilename);
- } catch (\ErrorException $ex) {
- // Not an image, or not a valid image?
- $imgsize = false;
- }
+ // Draw text
+ imagestring($image, 5, 5, 5, (string) $status, $foreground);
+ imagestring($image, 5, 5, 25, $message, $foreground);
- // find out how much memory this image needs for processing, probably only works for jpegs
- // from comments on http://www.php.net/imagecreatefromjpeg
- if ($imgsize && isset($imgsize['bits']) && (isset($imgsize['channels']))) {
- $memoryNeeded = round(($imgsize[0] * $imgsize[1] * $imgsize['bits'] * $imgsize['channels'] / 8 + pow(2, 16)) * 1.65);
- $memorySpare = $memoryAvailable - $memoryUsed - $memoryNeeded;
- if ($memorySpare > 0) {
- // we have enough memory to load this file
- return true;
- } else {
- // not enough memory to load this file
- $image_info = sprintf('%.2fKB, %d × %d %d bits %d channels', filesize($serverFilename) / 1024, $imgsize[0], $imgsize[1], $imgsize['bits'], $imgsize['channels']);
- Log::addMediaLog('Cannot create thumbnail ' . $serverFilename . ' (' . $image_info . ') memory avail: ' . $memoryAvailable . ' used: ' . $memoryUsed . ' needed: ' . $memoryNeeded . ' spare: ' . $memorySpare);
- return false;
- }
- } else {
- // assume there is enough memory
- // TODO find out how to check memory needs for gif and png
- return true;
- }
+ http_response_code(404);
+ header('Content-Type: image/png');
+ imagepng($image);
+ imagedestroy($image);
}
+
}
diff --git a/app/Functions/FunctionsPrint.php b/app/Functions/FunctionsPrint.php
index fa0de25f13..edde1f7b2c 100644
--- a/app/Functions/FunctionsPrint.php
+++ b/app/Functions/FunctionsPrint.php
@@ -563,6 +563,11 @@ class FunctionsPrint {
$uniquefacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
$quickfacts = preg_split('/[, ;:]+/', $WT_TREE->getPreference('REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
break;
+ case 'OBJE':
+ $addfacts = ['NOTE'];
+ $uniquefacts = ['_PRIM'];
+ $quickfacts = [];
+ break;
default:
return;
}
diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php
index 552ed6cf18..4e758149d7 100644
--- a/app/Functions/FunctionsPrintFacts.php
+++ b/app/Functions/FunctionsPrintFacts.php
@@ -233,7 +233,17 @@ class FunctionsPrintFacts {
break;
case 'FILE':
if (Auth::isEditor($fact->getParent()->getTree())) {
- echo '<div class="field">', Filter::escapeHtml($fact->getValue()), '</div>';
+ echo '<div class="field">', Filter::escapeHtml($fact->getValue());
+
+ if ($fact->getParent()->fileExists('main') && $fact->getParent()->getTree()->getPreference('SHOW_MEDIA_DOWNLOAD') >= Auth::accessLevel($fact->getParent()->getTree())) {
+ echo ' — <a href="' . $fact->getParent()->getHtmlUrlDirect('main', true) . '">' . I18N::translate('Download file') . '</a>';
+ }
+ echo '</div>';
+
+ if (!$fact->getParent()->fileExists('main')) {
+ echo '<p class="ui-state-error">' . I18N::translate('The file “%s” does not exist.', $fact->getParent()->getFilename()) . '</p>';
+ }
+
if ($fact->getParent() instanceof Media && $fact->getParent()->fileExists()) {
// The file size
echo GedcomTag::getLabelValue('__FILE_SIZE__', $fact->getParent()->getFilesize());
@@ -673,7 +683,7 @@ class FunctionsPrintFacts {
echo '<br class="media-separator" style="clear:both;">';
}
echo '<div class="media-display"><div class="media-display-image">';
- echo $media->displayImage();
+ echo $media->displayImage(100, 100, 'contain', []);
echo '</div>';
echo '<div class="media-display-title">';
echo '<a href="', $media->getHtmlUrl(), '">', $media->getFullName(), '</a>';
@@ -1160,7 +1170,7 @@ class FunctionsPrintFacts {
echo '<td class="optionbox ', $styleadd, ' wrap">';
if ($media) {
echo '<span class="field">';
- echo $media->displayImage();
+ echo $media->displayImage(100, 100, 'contain', []);
echo '<a href="' . $media->getHtmlUrl() . '">';
echo '<em>';
foreach ($media->getAllNames() as $name) {
diff --git a/app/Functions/FunctionsPrintLists.php b/app/Functions/FunctionsPrintLists.php
index 47303a3682..baf25fa8dd 100644
--- a/app/Functions/FunctionsPrintLists.php
+++ b/app/Functions/FunctionsPrintLists.php
@@ -1244,7 +1244,7 @@ class FunctionsPrintLists {
}
$html .= '<tr' . $class . '>';
// Media object thumbnail
- $html .= '<td>' . $media_object->displayImage() . '</td>';
+ $html .= '<td>' . $media_object->displayImage(100, 100, 'contain', []) . '</td>';
// Media object name(s)
$html .= '<td data-sort="' . Filter::escapeHtml($media_object->getSortName()) . '">';
$html .= '<a href="' . $media_object->getHtmlUrl() . '" class="list_item name2">' . $name . '</a>';
diff --git a/app/Individual.php b/app/Individual.php
index 87ba15c43b..2917c71984 100644
--- a/app/Individual.php
+++ b/app/Individual.php
@@ -443,15 +443,20 @@ class Individual extends GedcomRecord {
* Display the prefered image for this individual.
* Use an icon if no image is available.
*
+ * @param int $width Pixels
+ * @param int $height Pixels
+ * @param string $fit "crop" or "contain"
+ * @param string[] $attributes Additional HTML attributes
+ *
* @return string
*/
- public function displayImage() {
+ public function displayImage($width, $height, $fit, $attributes) {
$media = $this->findHighlightedMedia();
- if ($media && $this->canShow()) {
- // Thumbnail exists - use it.
- return $media->displayImage();
+ if ($media !== null) {
+ // Image exists - use it.
+ return $media->displayImage($width, $height, $fit, $attributes);
} elseif ($this->tree->getPreference('USE_SILHOUETTE')) {
- // No thumbnail exists - use an icon
+ // No image exists - use an icon
return '<i class="icon-silhouette-' . $this->getSex() . '"></i>';
} else {
return '';
diff --git a/app/Media.php b/app/Media.php
index 08aae4ba9d..ba72d41ebb 100644
--- a/app/Media.php
+++ b/app/Media.php
@@ -15,9 +15,8 @@
*/
namespace Fisharebest\Webtrees;
-use Exception;
-use Fisharebest\Webtrees\Functions\FunctionsMedia;
use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
+use League\Glide\Urls\UrlBuilderFactory;
/**
* A GEDCOM media (OBJE) object.
@@ -141,7 +140,6 @@ class Media extends GedcomRecord {
*/
public function getServerFilename($which = 'main') {
$MEDIA_DIRECTORY = $this->tree->getPreference('MEDIA_DIRECTORY');
- $THUMBNAIL_WIDTH = $this->tree->getPreference('THUMBNAIL_WIDTH');
if ($this->isExternal() || !$this->file) {
// External image, or (in the case of corrupt GEDCOM data) no image at all
@@ -161,12 +159,7 @@ class Media extends GedcomRecord {
if (file_exists($user_thumb)) {
return $user_thumb;
}
- // Does the folder exist for this thumbnail?
- if (!is_dir(dirname($file)) && !File::mkdir(dirname($file))) {
- Log::addMediaLog('The folder ' . dirname($file) . ' could not be created for ' . $this->getXref());
- return $file;
- }
// Is there a corresponding main image?
$main_file = WT_DATA_DIR . $MEDIA_DIRECTORY . $this->file;
if (!file_exists($main_file)) {
@@ -174,69 +167,6 @@ class Media extends GedcomRecord {
return $file;
}
- // Try to create a thumbnail automatically
-
- try {
- $imgsize = getimagesize($main_file);
- // Image small enough to be its own thumbnail?
- if ($imgsize[0] > 0 && $imgsize[0] <= $THUMBNAIL_WIDTH) {
- try {
- copy($main_file, $file);
- Log::addMediaLog('Thumbnail created for ' . $main_file . ' (copy of main image)');
- } catch (\ErrorException $ex) {
- Log::addMediaLog('Thumbnail could not be created for ' . $main_file . ' (copy of main image)');
- }
- } else {
- if (FunctionsMedia::hasMemoryForImage($main_file)) {
- try {
- switch ($imgsize['mime']) {
- case 'image/png':
- $main_image = imagecreatefrompng($main_file);
- break;
- case 'image/gif':
- $main_image = imagecreatefromgif($main_file);
- break;
- case 'image/jpeg':
- $main_image = imagecreatefromjpeg($main_file);
- break;
- default:
- return $file; // Nothing else we can do :-(
- }
- if ($main_image) {
- // How big should the thumbnail be?
- $width = $THUMBNAIL_WIDTH;
- $height = round($imgsize[1] * ($width / $imgsize[0]));
- $thumb_image = imagecreatetruecolor($width, $height);
- // Create a transparent background, instead of the default black one
- imagesavealpha($thumb_image, true);
- imagefill($thumb_image, 0, 0, imagecolorallocatealpha($thumb_image, 0, 0, 0, 127));
- // Shrink the image
- imagecopyresampled($thumb_image, $main_image, 0, 0, 0, 0, $width, $height, $imgsize[0], $imgsize[1]);
- switch ($imgsize['mime']) {
- case 'image/png':
- imagepng($thumb_image, $file);
- break;
- case 'image/gif':
- imagegif($thumb_image, $file);
- break;
- case 'image/jpeg':
- imagejpeg($thumb_image, $file);
- break;
- }
- imagedestroy($main_image);
- imagedestroy($thumb_image);
- Log::addMediaLog('Thumbnail created for ' . $main_file);
- }
- } catch (\ErrorException $ex) {
- Log::addMediaLog('Failed to create thumbnail for ' . $main_file . ' (' . $ex . ')');
- }
- } else {
- Log::addMediaLog('Not enough memory to create thumbnail for ' . $main_file);
- }
- }
- } catch (\ErrorException $ex) {
- // Not an image, or not a valid image?
- }
return $file;
}
@@ -274,7 +204,8 @@ class Media extends GedcomRecord {
// Round up to the nearest KB.
$size = (int) (($size + 1023) / 1024);
- return /* I18N: size of file in KB */ I18N::translate('%s KB', I18N::number($size));
+ return /* I18N: size of file in KB */
+ I18N::translate('%s KB', I18N::number($size));
}
/**
@@ -362,8 +293,6 @@ class Media extends GedcomRecord {
* @return array
*/
public function getImageAttributes($which = 'main', $addWidth = 0, $addHeight = 0) {
- $THUMBNAIL_WIDTH = $this->tree->getPreference('THUMBNAIL_WIDTH');
-
$var = $which . 'imagesize';
if (!empty($this->$var)) {
return $this->$var;
@@ -382,14 +311,10 @@ class Media extends GedcomRecord {
$imageTypes = ['', 'GIF', 'JPG', 'PNG', 'SWF', 'PSD', 'BMP', 'TIFF', 'TIFF', 'JPC', 'JP2', 'JPX', 'JB2', 'SWC', 'IFF', 'WBMP', 'XBM'];
$imgsize['ext'] = $imageTypes[0 + $imgsize[2]];
// this is for display purposes, always show non-adjusted info
- $imgsize['WxH'] =
- /* I18N: image dimensions, width × height */
+ $imgsize['WxH']
+ = /* I18N: image dimensions, width × height */
I18N::translate('%1$s × %2$s pixels', I18N::number($imgsize['0']), I18N::number($imgsize['1']));
$imgsize['imgWH'] = ' width="' . $imgsize['adjW'] . '" height="' . $imgsize['adjH'] . '" ';
- if (($which == 'thumb') && ($imgsize['0'] > $THUMBNAIL_WIDTH)) {
- // don’t let large images break the dislay
- $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
- }
}
} catch (\ErrorException $ex) {
// Not an image, or not a valid image?
@@ -407,10 +332,6 @@ class Media extends GedcomRecord {
$imgsize['mime'] = '';
$imgsize['WxH'] = '';
$imgsize['imgWH'] = '';
- if ($this->isExternal()) {
- // don’t let large external images break the dislay
- $imgsize['imgWH'] = ' width="' . $THUMBNAIL_WIDTH . '" ';
- }
}
if (empty($imgsize['mime'])) {
@@ -457,15 +378,45 @@ class Media extends GedcomRecord {
* @return string
*/
public function getHtmlUrlDirect($which = 'main', $download = false) {
- // “cb” is “cache buster”, so clients will make new request if anything significant about the user or the file changes
- // The extension is there so that image viewers (e.g. colorbox) can do something sensible
- $thumbstr = ($which == 'thumb') ? '&amp;thumb=1' : '';
- $downloadstr = ($download) ? '&dl=1' : '';
+ return $this->imageUrl(0, 0, '');
+ }
- return
- 'mediafirewall.php?mid=' . $this->getXref() . $thumbstr . $downloadstr .
- '&amp;ged=' . $this->tree->getNameUrl() .
- '&amp;cb=' . $this->getEtag($which);
+ /**
+ * @param int $width max width in pixels
+ * @param int $height max height in pixels
+ * @param string $fit "crop" or ""
+ *
+ * @return string
+ */
+ public function imageUrl($width, $height, $fit) {
+ // Sign the URL, to protect against mass-resize attacks.
+ $glide_key = Site::getPreference('glide-key');
+ if (empty($glide_key)) {
+ $glide_key = bin2hex(random_bytes(128));
+ Site::setPreference('glide-key', $glide_key);
+ }
+
+ if (Auth::accessLevel($this->getTree()) > $this->getTree()->getPreference('SHOW_NO_WATERMARK')) {
+ $mark = 'watermark.png';
+ } else {
+ $mark = '';
+ }
+
+ $url = UrlBuilderFactory::create(WT_BASE_URL, $glide_key)
+ ->getUrl('mediafirewall.php', [
+ 'mid' => $this->getXref(),
+ 'ged' => $this->tree->getName(),
+ 'w' => $width,
+ 'h' => $height,
+ 'fit' => $fit,
+ 'mark' => $mark,
+ 'markh' => '100h',
+ 'markw' => '100w',
+ 'markalpha' => 25,
+ 'or' => 0, // Intervention uses exif_read_data() which is very buggy.
+ ]);
+
+ return $url;
}
/**
@@ -546,37 +497,42 @@ class Media extends GedcomRecord {
/**
* Display an image-thumbnail or a media-icon, and add markup for image viewers such as colorbox.
*
+ * @param int $width Pixels
+ * @param int $height Pixels
+ * @param string $fit "crop" or "contain"
+ * @param string[] $attributes Additional HTML attributes
+ *
* @return string
*/
- public function displayImage() {
+ public function displayImage($width, $height, $fit, $attributes = []) {
// Default image for external, missing or corrupt images.
- $image =
- '<i' .
- ' dir="' . 'auto' . '"' . // For the tool-tip
- ' class="' . 'icon-mime-' . str_replace('/', '-', $this->mimeType()) . '"' .
+ $image
+ = '<i' .
+ ' dir="auto"' . // For the tool-tip
+ ' class="icon-mime-' . str_replace('/', '-', $this->mimeType()) . '"' .
' title="' . strip_tags($this->getFullName()) . '"' .
'></i>';
// Use a thumbnail image.
if (!$this->isExternal()) {
- try {
- $imgsize = getimagesize($this->getServerFilename('thumb'));
- $image =
- '<img' .
- ' dir="' . 'auto' . '"' . // For the tool-tip
- ' src="' . $this->getHtmlUrlDirect('thumb') . '"' .
- ' alt="' . strip_tags($this->getFullName()) . '"' .
- ' title="' . strip_tags($this->getFullName()) . '"' .
- ' ' . $imgsize[3] . // height="yyy" width="xxx"
- '>';
- } catch (Exception $ex) {
- // Image file unreadable or Corrupt.
+ // Generate multiple images for displays with higher pixel densities.
+ $srcset = [];
+ foreach ([2,3,4] as $x) {
+ $srcset[] = $this->imageUrl($width * $x, $height * $x, $fit) . ' ' . $x . 'x';
}
+
+ $image = '<img ' . Html::attributes($attributes + [
+ 'dir' => 'auto',
+ 'src' => $this->imageUrl($width, $height, $fit),
+ 'srcset' => implode(',', $srcset),
+ 'alt' => strip_tags($this->getFullName()),
+ 'title' => strip_tags($this->getFullName()),
+ ]) . '>';
}
return
'<a' .
- ' class="' . 'gallery' . '"' .
+ ' class="gallery"' .
' href="' . $this->getHtmlUrlDirect('main') . '"' .
' type="' . $this->mimeType() . '"' .
' data-obje-url="' . $this->getHtmlUrl() . '"' .
diff --git a/app/Module/AlbumModule.php b/app/Module/AlbumModule.php
index d7580f457f..41f92a23d9 100644
--- a/app/Module/AlbumModule.php
+++ b/app/Module/AlbumModule.php
@@ -194,7 +194,7 @@ class AlbumModule extends AbstractModule implements ModuleTabInterface {
}
}
$html .= '<li class="album-list-item">';
- $html .= '<div class="album-image">' . $media->displayImage() . '</div>';
+ $html .= '<div class="album-image">' . $media->displayImage(100, 100, 'contain', []) . '</div>';
$html .= '<div class="album-title">' . $menu->bootstrap4() . '</div>';
$html .= '</li>';
}
diff --git a/app/Module/GoogleMapsModule.php b/app/Module/GoogleMapsModule.php
index 98ee1e58bd..790c36d6a1 100644
--- a/app/Module/GoogleMapsModule.php
+++ b/app/Module/GoogleMapsModule.php
@@ -860,7 +860,7 @@ class GoogleMapsModule extends AbstractModule implements ModuleConfigInterface,
// get thumbnail image
if ($person->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- $image = $person->displayImage();
+ $image = $person->displayImage(40, 50, 'crop', []);
} else {
$image = '';
}
diff --git a/app/Module/InteractiveTree/TreeView.php b/app/Module/InteractiveTree/TreeView.php
index 74b66bcc39..ed84293bad 100644
--- a/app/Module/InteractiveTree/TreeView.php
+++ b/app/Module/InteractiveTree/TreeView.php
@@ -369,7 +369,7 @@ class TreeView {
*/
private function getThumbnail(Individual $individual) {
if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- return $individual->displayImage();
+ return $individual->displayImage(40, 50, 'crop', []);
} else {
return '';
}
diff --git a/app/Module/SlideShowModule.php b/app/Module/SlideShowModule.php
index b8d69c8429..de4c77bcb9 100644
--- a/app/Module/SlideShowModule.php
+++ b/app/Module/SlideShowModule.php
@@ -159,7 +159,7 @@ class SlideShowModule extends AbstractModule implements ModuleBlockInterface {
}
$content .= '<div class="center" id="random_picture_content' . $block_id . '">';
$content .= '<table id="random_picture_box"><tr><td class="details1">';
- $content .= $random_media->displayImage();
+ $content .= $random_media->displayImage(200, 200, '', []);
$content .= '<br>';
$content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
diff --git a/app/Report/ReportPdf.php b/app/Report/ReportPdf.php
index b8c6fe5eed..94ea93d6f4 100644
--- a/app/Report/ReportPdf.php
+++ b/app/Report/ReportPdf.php
@@ -259,7 +259,8 @@ class ReportPdf extends ReportBase {
* @return ReportPdfImage
*/
public function createImageFromObject($mediaobject, $x, $y, $w, $h, $align, $ln) {
- return new ReportPdfImage($mediaobject->getServerFilename('thumb'), $x, $y, $w, $h, $align, $ln);
+ $url = $mediaobject->imageUrl($w, $h, '');
+ return new ReportPdfImage($url, $x, $y, $w, $h, $align, $ln);
}
/**
diff --git a/app/Theme/AbstractTheme.php b/app/Theme/AbstractTheme.php
index 047e32a1d6..2fb3d87ba2 100644
--- a/app/Theme/AbstractTheme.php
+++ b/app/Theme/AbstractTheme.php
@@ -821,7 +821,7 @@ abstract class AbstractTheme {
public function individualBox(Individual $individual) {
$personBoxClass = array_search($individual->getSex(), ['person_box' => 'M', 'person_boxF' => 'F', 'person_boxNN' => 'U']);
if ($individual->canShow() && $individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- $thumbnail = $individual->displayImage();
+ $thumbnail = $individual->displayImage(40, 50, 'crop', []);
} else {
$thumbnail = '';
}
@@ -873,7 +873,7 @@ abstract class AbstractTheme {
public function individualBoxLarge(Individual $individual) {
$personBoxClass = array_search($individual->getSex(), ['person_box' => 'M', 'person_boxF' => 'F', 'person_boxNN' => 'U']);
if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- $thumbnail = $individual->displayImage();
+ $thumbnail = $individual->displayImage(40, 50, 'crop', []);
} else {
$thumbnail = '';
}
@@ -916,7 +916,7 @@ abstract class AbstractTheme {
public function individualBoxSmall(Individual $individual) {
$personBoxClass = array_search($individual->getSex(), ['person_box' => 'M', 'person_boxF' => 'F', 'person_boxNN' => 'U']);
if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) {
- $thumbnail = $individual->displayImage();
+ $thumbnail = $individual->displayImage(40, 50, 'crop', []);
} else {
$thumbnail = '';
}