Browse Source

implement image mime types support

PHP-GTK3
yggverse 4 months ago
parent
commit
1086d48051
  1. 18
      src/Entity/Browser/Container/Page/Content.php
  2. 34
      src/Entity/Browser/Container/Page/Content/Image.php

18
src/Entity/Browser/Container/Page/Content.php

@ -113,14 +113,20 @@ class Content @@ -113,14 +113,20 @@ class Content
break;
/* @TODO
case 'image/gif':
case 'image/jpeg':
case 'image/png':
case 'image/webp':
case Filesystem::MIME_IMAGE_GIF:
case Filesystem::MIME_IMAGE_JPEG:
case Filesystem::MIME_IMAGE_PNG:
case Filesystem::MIME_IMAGE_WEBP:
$document = new Image(
$this
);
$document->set(
$data
);
break;
*/
default:

34
src/Entity/Browser/Container/Page/Content/Image.php

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Yggverse\Yoda\Entity\Browser\Container\Page\Content;
use \Yggverse\Yoda\Entity\Browser\Container\Page\Content;
class Image
{
public \GtkImage $gtk;
// Dependencies
public Content $content;
public function __construct(
Content $content
) {
// Init dependency
$this->content = $content;
// Init image object
$this->gtk = new \GtkImage;
}
public function set(
string $data
): void
{
$this->gtk->new_from_resource(
$data
);
}
}
Loading…
Cancel
Save