{include file='header'}
-{if $articleContent->getImage()}
+{if $articleContent->getImage() && $articleContent->getImage()->hasThumbnail('large')}
<section class="section">
<figure class="articleImage" itemprop="image" itemscope itemtype="http://schema.org/ImageObject">
<div class="articleImageWrapper">{@$articleContent->getImage()->getThumbnailTag('large')}</div>
{foreach from=$relatedArticles item='relatedArticle'}
<li>
<a href="{$relatedArticle->getLink()}">
- {if $relatedArticle->getImage()}
+ {if $relatedArticle->getImage() && $relatedArticle->getImage()->hasThumbnail('tiny')}
<div class="box128">
<div class="articleListImage">{@$relatedArticle->getImage()->getThumbnailTag('tiny')}</div>
{/if}
{@$relatedArticle->getFormattedTeaser()}
</div>
</div>
-
- {if $relatedArticle->getImage()}
+
+ {if $relatedArticle->getImage() && $relatedArticle->getImage()->hasThumbnail('tiny')}
</div>
{/if}
</a>
{foreach from=$objects item='article'}
<li>
<a href="{$article->getLink()}">
- {if $article->getImage()}
+ {if $article->getImage() && $article->getImage()->hasThumbnail('tiny')}
<div class="box128">
<div class="articleListImage">{@$article->getImage()->getThumbnailTag('tiny')}</div>
{/if}
{@$article->getFormattedTeaser()}
</div>
</div>
-
- {if $article->getImage()}
+
+ {if $article->getImage() && $article->getImage()->hasThumbnail('tiny')}
</div>
{/if}
</a>
{foreach from=$boxArticleList item=boxArticle}
<li>
<a href="{$boxArticle->getLink()}">
- {if $boxArticle->getImage()}
+ {if $boxArticle->getImage() && $boxArticle->getImage()->hasThumbnail('small')}
<div class="articleListImage">{@$boxArticle->getImage()->getThumbnailTag('small')}</div>
{/if}
-{if $media->isImage}
+{if $media->isImage && $media->hasThumbnail('small')}
<div class="mediaThumbnail">
{@$media->getThumbnailTag('small')}
</div>
<dt><label for="image">{lang}wcf.acp.article.image{/lang}</label></dt>
<dd>
<div id="imageDisplay" class="selectedImagePreview">
- {if $images[0]|isset}
+ {if $images[0]|isset && $images[0]->hasThumbnail('small')}
{@$images[0]->getThumbnailTag('small')}
{/if}
</div>
{/if}
</dd>
</dl>
- {elseif $action == 'edit' && $images[0]|isset}
+ {elseif $action == 'edit' && $images[0]|isset && $images[0]->hasThumbnail('small')}
<dl>
<dt>{lang}wcf.acp.article.image{/lang}</dt>
<dd>
<dt><label for="image{@$availableLanguage->languageID}">{lang}wcf.acp.article.image{/lang}</label></dt>
<dd>
<div id="imageDisplay{@$availableLanguage->languageID}">
- {if $images[$availableLanguage->languageID]|isset}
+ {if $images[$availableLanguage->languageID]|isset && $images[$availableLanguage->languageID]->hasThumbnail('small')}
{@$images[$availableLanguage->languageID]->getThumbnailTag('small')}
{/if}
</div>
{/if}
</dd>
</dl>
- {elseif $action == 'edit' && $images[$availableLanguage->languageID]|isset}
+ {elseif $action == 'edit' && $images[$availableLanguage->languageID]|isset && $images[$availableLanguage->languageID]->hasThumbnail('small')}
<dl>
<dt>{lang}wcf.acp.article.image{/lang}</dt>
<dd>
<dt><label for="image">{lang}wcf.acp.box.image{/lang}</label></dt>
<dd>
<div id="imageDisplay" class="selectedImagePreview">
- {if $images[0]|isset}
+ {if $images[0]|isset && $images[0]->hasThumbnail('small')}
{@$images[0]->getThumbnailTag('small')}
{/if}
</div>
{/if}
</dd>
</dl>
- {elseif $action == 'edit' && $images[0]|isset}
+ {elseif $action == 'edit' && $images[0]|isset && $images[0]->hasThumbnail('small')}
<dl>
<dt>{lang}wcf.acp.box.image{/lang}</dt>
<dd>
<dt><label for="image{@$availableLanguage->languageID}">{lang}wcf.acp.box.image{/lang}</label></dt>
<dd>
<div id="imageDisplay{@$availableLanguage->languageID}" class="selectedImagePreview">
- {if $images[$availableLanguage->languageID]|isset}
+ {if $images[$availableLanguage->languageID]|isset && $images[$availableLanguage->languageID]->hasThumbnail('small')}
{@$images[$availableLanguage->languageID]->getThumbnailTag('small')}
{/if}
</div>
{/if}
</dd>
</dl>
- {elseif $action == 'edit' && $images[$availableLanguage->languageID]|isset}
+ {elseif $action == 'edit' && $images[$availableLanguage->languageID]|isset && $images[$availableLanguage->languageID]->hasThumbnail('small')}
<dl>
<dt>{lang}wcf.acp.box.image{/lang}</dt>
<dd>
-{if $media->isImage}
+{if $media->isImage && $media->hasThumbnail('small')}
<div class="mediaThumbnail">
{@$media->getThumbnailTag('small')}
</div>
return WCF::getSession()->getPermission('admin.content.cms.canManageMedia') || SimpleAclResolver::getInstance()->canAccess('com.woltlab.wcf.media', $this->mediaID);
}
+ /**
+ * Returns true if a thumbnail version with the given size is available.
+ *
+ * @param string $size
+ * @return boolean
+ * @throws \InvalidArgumentException
+ */
+ public function hasThumbnail($size) {
+ if (!isset(self::$thumbnailSizes[$size])) {
+ throw new \InvalidArgumentException("Unknown thumbnail size '".$size."'");
+ }
+
+ if ($this->{$size.'ThumbnailType'}) {
+ return true;
+ }
+
+ if ($this->width <= self::$thumbnailSizes[$size]['width'] && $this->height <= self::$thumbnailSizes[$size]['height']) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* Returns the storage path of the media files.
*