19 declare(strict_types=1);
40 $this->media_manager = $this->domain->mediaObject();
41 $this->image_converters =
new Images(
true);
47 return "thumbs/Standard.png";
55 $mob = new \ilObjMediaObject($mob_id);
56 $item = $mob->getMediaItem(
"Standard");
58 if ($item?->getFormat() ===
"image/svg+xml") {
59 return $mob->getStandardSrc();
64 if ($this->media_manager->hasLocalFile($mob_id, $thumb_path)) {
65 return $this->media_manager->getLocalSrc($mob_id, $thumb_path);
70 if ($preview_src !==
"") {
75 if ($item?->getLocationType() ===
"LocalFile") {
76 if ($item?->getThumbTried() !==
"y") {
79 $item?->getLocation(),
83 $item?->writeThumbTried(
"y");
84 if ($this->media_manager->hasLocalFile($mob_id, $thumb_path)) {
85 return $this->media_manager->getLocalSrc($mob_id, $thumb_path);
89 if (str_starts_with($item?->getFormat(),
"image/")) {
90 return $item?->getLocation();
95 return \ilUtil::getImagePath(
"standard/icon_mob.svg");
102 string $target_location,
104 $is_image = is_int(strpos($format,
"image/"));
106 if (!$this->media_manager->hasLocalFile($mob_id, $location)) {
114 $tempStream = fopen(
'php://temp',
'w+');
115 stream_copy_to_stream($this->media_manager->getLocationStream($mob_id, $location)->detach(), $tempStream);
117 $stream =
new Stream($tempStream);
119 $converter = $this->image_converters->resizeToFixedSize(
124 $this->output_options
125 ->withQuality($image_quality)
128 $this->media_manager->addStream(
131 $converter->getStream()
145 "mob_vpreview.jpeg");
146 foreach ($ppics as $pic) {
147 if ($this->media_manager->hasLocalFile($mob_id, $pic)) {
148 return $this->media_manager->getLocalSrc($mob_id, $pic);