I want to start a discussion about how the image sizes for portal output should be set in the future.
At the moment, the size of images is sometimes set in portal classes, e.g. for module news:
- Code: Alles auswählen
$arrNews["news_image"] = "<img src=\""._webpath_."/image.php?image=".urlencode($objNews->getStrImage())."&maxWidth=400&maxHeight=400\" >";
or set in element settings, e.g. for module gallery/element image
or is set nowhere, e.g. element paragraph
- Code: Alles auswählen
$strReturn .= "<img src=\"".$this->arrElementData["absatz_bild"]."\" alt=\"".$this->arrElementData["absatz_bild"]."\" /><br /><br />\n";
As our aim is to be as flexible as possible without touching the classes we should think about an other and in my opinion general way to set these sizes.
My idea would be to set the image sizes only in the templates. So we could add more template sections e.g. for module news:
- Code: Alles auswählen
<news_list_image>
<img src="_webpath_/image.php?image=%%news_image%%&maxWidth=200&maxHeight=200" alt="%%news_title%%" />
</news_list_image>
<news_detail_image>
<img src="_webpath_/image.php?image=%%news_image%%&maxWidth=400&maxHeight=400" alt="%%news_title%%" />
</news_detail_image>
And I think this would be even more flexible (of course it's some more code, but therefor very flexible):
- Code: Alles auswählen
<news_list>
<div class="newsList">
<div class="newsListHeader">
<a href="%%news_more_link_href%%"><img src="_webpath_/image.php?image=%%news_image%%&maxWidth=200&maxHeight=200" alt="%%news_title%%" /></a>
<div class="newsListTitle">
<h2><a href="%%news_more_link_href%%">%%news_title%%</a></h2>
</div>
<div class="newsListMore">%%news_start_date%%</div>
<div class="clearer"></div>
</div>
<div class="newsListTeaser">
<div>%%news_intro%% %%news_more_link%%</div>
</div>
</div>
</news_list>
<news_list_with_image>
<div class="newsList">
<div class="newsListHeader">
<div class="newsListTitle">
<h2><a href="%%news_more_link_href%%">%%news_title%%</a></h2>
</div>
<div class="newsListMore">%%news_start_date%%</div>
<div class="clearer"></div>
</div>
<div class="newsListTeaser">
<div>%%news_intro%% %%news_more_link%%</div>
</div>
</div>
</news_list_with_image>
<news_detail>
<div class="newsDetail">
<h2>%%news_title%%</h2> %%news_start_date%%
<p class="newsTeaser">%%news_intro%%</p>
<p>%%news_text%%</p>
<p>%%news_back_link%%</p>
</div>
</news_detail>
<news_detail_with_image>
<div class="newsDetail">
<h2>%%news_title%%</h2> %%news_start_date%%
<p class="newsTeaser">%%news_intro%%</p>
<img src="_webpath_/image.php?image=%%news_image%%&maxWidth=400&maxHeight=400" alt="%%news_title%%" />
<p>%%news_text%%</p>
<p>%%news_back_link%%</p>
</div>
</news_detail_with_image>
We could do the same in module gallery:
- Code: Alles auswählen
<piclist_pic>
<div style="text-align: center;">
<div><a href="%%pic_href%%"><img src="_webpath_/image.php?image=%%pic%%&maxWidth=150&maxHeight=150" /></a></div>
<div>%%name%%</div>
</div>
</piclist_pic>
And also in the paragraph/image element we could integrate templates as well, which would be great anyway in my opinion. The template could be set in the element general-settings which will may come with 3.3.0. E.g. it could look like this for element paragraph:
- Code: Alles auswählen
<paragraph>
<h2>%%paragraph_title%%</h2>
<p>%%paragraph_content%%<p>
</paragraph>
<paragraph_with_image>
<h2>%%paragraph_title%%</h2>
<img src="_webpath_/image.php?image=%%paragraph_image%%&maxWidth=150&maxHeight=150" alt="%%paragraph_title%%" />
<p>%%paragraph_content%%<p>
</paragraph_with_image>
<paragraph_with_link>
<h2>%%paragraph_title%%</h2>
<p>%%paragraph_content%%<p>
<a href="%%paragraph_link%%">%%lang_readmore%%</a>
</paragraph_with_link>
<paragraph_with_image_and_link>
<h2>%%paragraph_title%%</h2>
<a href="%%paragraph_link%%"><img src="_webpath_/image.php?image=%%paragraph_image%%&maxWidth=150&maxHeight=150" alt="%%paragraph_title%%" /></a>
<p>%%paragraph_content%%<p>
<a href="%%paragraph_link%%">%%lang_readmore%%</a>
</paragraph_with_image_and_link>
The template-way would also be very flexible in calling the image.php, so instead of using the maxWidth/maxHeight parameters you could also use the new introduced (3.2.1) fixedWidth/fixedHeight parameters if you want real equal image sizes. Or if needed you could add the quality param to set the compression level...
But lets discuss this, maybe you guys have some other ideas? Where would you prefer setting the image sizes?
Thanks for your feedback!






