Dividing the loop to style post differently

You don’t need to alter the code for different formatting, you can simply use the :first-child pseudoclass in css. The foreach loop will, presumably, generate similar blocks of code, structured like this:

<div class="all-my-posts">
    <article class="my-slider-post">
     ...
    </article>
    <article ..>
    </article>
    ...
</div>

Now you can simply addres the first <article> block with css like this:

.my-slider-post:first-child h1 {...}
.my-slider-post:first-child h2 {...}

Another approach would be to add a counter to the foreach loop like this

$i=0;
foreach (...) {
    $i++;
    if ($i=1) { 
         echo '<div class="first-post>';
         { do your thing for the first post }
         echo '</div>';
    else { ... }
    }

This will give you an extra div to base your css on and allows you different function calls for the first and other posts to change the thumbnail.