Skip to content

[TASK] Allow compressing of images with special characters#5

Open
andreash-b13 wants to merge 1 commit intob13:masterfrom
andreash-b13:patch-folder_name_fix
Open

[TASK] Allow compressing of images with special characters#5
andreash-b13 wants to merge 1 commit intob13:masterfrom
andreash-b13:patch-folder_name_fix

Conversation

@andreash-b13
Copy link
Copy Markdown

No description provided.

if ($file instanceof \Schmitzal\Tinyimg\Domain\Model\File) {
$file = $this->resourceFactory->getFileObject($file->getUid());
if (filesize(GeneralUtility::getFileAbsFileName($file->getPublicUrl())) > 0) {
if (filesize(GeneralUtility::getFileAbsFileName(urldecode($file->getPublicUrl()))) > 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, ich weiss nicht ob das so cool ist, ich denke mal $file->getPublicUrl()encoded die url, und dann wird sie hier wieder decoded, gibts da nicht evtl. eine andere Methode, den den Pfad uncodiert zurückgibt?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fand ich auch schön, wenn es da eine gibt. Kennst du eine?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

musst du gucken ...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jo also der macht das ziemlich früh im core. Ich müsste mir halt stattdessen die URL selbst zusammen bauen aus identifier und storage (hier fileadmin). Was meinst du ist besser?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ja, das ist besser

$fileSize = $this->pushToTinyPngAndStoreToCdn($file);
} else {
$publicUrl = PATH_site . $file->getPublicUrl();
$publicUrl = PATH_site . urldecode($file->getPublicUrl());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s. o.

$source = \Tinify\fromFile($publicUrl);
$source->toFile($publicUrl);

// Sanitize URL in order to check if there are any special characters.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mh, sollte das nicht schon vorher passiert sein? ich finde das gehört hier nicht hier, dass der CompressImageService das file umbennt, das müsste anders gehen

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was schwebt dir da denn vor?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das kommt ja nur vor, wenn Du das Convert-Command über CLI ausführst, und die Datei, ist noch nicht "richtig" umbenannt, oder? Evtl. kannst Du ein weiteres Command bauen, welches Dateien richtig umbennt? (evtl. auch unabh. von dieser Extension?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants