Script to create an image preview

Hi, I have the code:

<?php
if ( is_page('/nab/2811/') ) :
?>
<div id="set-new">
        <div class="morepics">{section name=j loop=$nab.adim}<a title="{$nab.name}" href="{$nab.adim[j].link_raw}" target="_blank" rel="mainpic"><img src="/makeup/pic-55.png" /></a>{/section}</div>
</div>
<?php else : ?>
        <p class="glass">  {section name=j loop=$nab.adim}<a title="{$nab.name}" href="{$nab.adim[j].link_raw}" target="_blank" rel="mainpic">{$smarty.section.j.index+1}</a>{if not $smarty.section.j.last} | {/if}{/section}</p>
<?php endif; ?>

this is a test page of the site.. you need to create instead of “pic-55.png” an image of a certain size was cached and generated, and the image itself was taken from the 2nd part of the code


Answer 1, authority 100%

It is necessary that the logic work first, creating a preview and saving the name of the picture in a variable, and then the view will go on and the picture will be displayed. Formulate a question, then I will clarify the answer.