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

Изображение без иконки #9

Closed
KKKozlowski opened this issue Jul 10, 2012 · 1 comment
Closed

Изображение без иконки #9

KKKozlowski opened this issue Jul 10, 2012 · 1 comment

Comments

@KKKozlowski
Copy link

Если не установлен php-gd, или если при генерации иконки изображения php упирается в память, то файл остается без иконки.

Для красоты я сделал следущее:
system/Model/File.php:
было:

                           if ($ico == "preview") {
                                        $ico = $this->registry['path']['upload'] . "_thumb/" . $md5;
                                } else {
                                        $ico = "img/ftypes/" . $ico;
                                }

стало:

                           if ($ico == "preview") {
                                        $ico = $this->registry['path']['upload'] . "_thumb/" . $md5;
                                        if (!is_readable($ico)) $ico = "img/ftypes/image.png";
                                } else {
                                        $ico = "img/ftypes/" . $ico;
                                }

PS может в конфиге добавить опцию: "делать иконки для изображений", чтобы была возможность не "мучать" хостинг без GD, и с малым количеством выделенной памяти под php
system/config.ini:

[fm]
* * *
genImageThumb = false

system/Model/Save.php:

            if  ( ($this->registry["fm"]["genImageThumb"] == true) and ( (strtolower($ext) == "gif") or (strtolower($ext) == "png") or (strtolower($ext) == "jpg") or (strtolower($ext) == "jpeg") ) ) {
                $thumb = new Model_Thumb();
                $thumb->img_resize($uploadDirectory . $this->md5, $_thumbPath . $this->md5, 150, 120);
            };
@Zazza
Copy link
Owner

Zazza commented Jul 11, 2012

Спасибо поправил! Единственное, сделал так:

if ($ico == "preview") {
$ico = $this->registry['path']['upload'] . "_thumb/" . $md5;
if (!is_readable($this->registry['path']['root'] . "/" . $ico)) { $ico = "img/ftypes/image.png"; }
} else {
$ico = "img/ftypes/" . $ico;
}

указав абсолютный путь до previw

@Zazza Zazza closed this as completed Dec 27, 2013
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

No branches or pull requests

2 participants