Adjusting a function to show a specific size of im

2019-08-03 09:30发布

问题:

With the code below now working can anyone suggest how I pull out the image from the collection at a larger size, this is only working for thumbnails at the moment.

<?php 
if(!hook("EditorsPick")):
/* ------------ Collections promoted to the home page ------------------- */
$home_collectionsx=get_home_page_promoted_collectionsx(16);
foreach ($home_collectionsx as $home_collectionx)
    {
    ?>
<div class="EditorsPick">
   <div class="HomePanel"><div class="HomePanelINtopEditors">
    <div class="HomePanelINtopHeader">Editors Pick</div>
    <div class="HomePanelINtopText">This is the editors pick of Asset Space...</div>
   <div class="EditorsPicImage"><div style="padding-top:<?php echo floor((155-$home_collectionx["thumb_height"])/2) ?>px; margin-top: -24px; margin-bottom: -15px;">
    <a href="<?php echo $baseurl_short?>pages/search.php?search=!collection<?php echo $home_collectionx["ref"] ?>" onClick="return CentralSpaceLoad(this,true);"><img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collectionx["thumb_width"] ?>" height="<?php echo $home_collectionx["thumb_height"] ?>" /></div>
    </div></div>
    </div>
    </div>
</div>
    <?php
    }
endif; # end hook homefeaturedcol
?>






function get_home_page_promoted_collectionsx($id=null)
{
    $filterClause = '';
    if(!is_null($id))
    {
        $filterClause = ' AND collection.ref = '.intval($id);
    }
    return sql_query("select collection.ref,collection.home_page_publish,collection.home_page_text,collection.home_page_image,resource.thumb_height,resource.thumb_width from collection left outer join resource on collection.home_page_image=resource.ref where collection.public=1 and collection.home_page_publish=1".$filterClause." order by collection.ref desc");
}

回答1:

    <img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="<?php echo $home_collectionx["thumb_width"] ?>" height="<?php echo $home_collectionx["thumb_height"] ?>" />

Why not edit this to set your desired size in pixels, like

    <img class="ImageBorder" src="<?php echo get_resource_path($home_collectionx["home_page_image"],false,"thm",false) ?>" width="1000" height="800" />


标签: function size