Form tiles in a rectangular ring

Dyalog APL, 8 bytes

×/¨1<⊂|⍳

This monadic function train takes height and width as right arguments and returns a 2D array of 0's (border) and 1's (interior). Test it on TryAPL.

How it works

×/¨1<⊂|⍳  Right argument: h w

       ⍳  Generate all index pairs (1-based) of a h×w array.
     ⊂    Enclose (h w), so it depth matches the one of the index array.
      |   For each pair (i j) compute the remainders of the division by (h w).
   1<     Compare all remainders with 1.
×/¨       Reduce each pair of Booleans by multiplication.

MATL, 10 bytes

2$lO6Lt4$(

This outputs an array containing zeros and ones.

Try it online!

2$l    % Implicit inputs M, N. Generate M×N array of ones
O      % Push number 0
6Lt    % Push [2 -1] twice, corresponding to index "2:end-1"
4$(    % Fill the center of the array with value 0. Implicit display

For graphical output, add 1YG at the end to display the array as an image (13 bytes) :

2$Ol6Lt4$(1YG

Try it at MATL Online! For example,

>> matl 2$Ol6Lt4$(1YG
> 5
> 7

produces

enter image description here


HTML/JS/CSS, 198 194 bytes

Graphical output version. The byte count doesn't include f= nor the three <input> elements which are used for demonstration purposes only. Saved 3 bytes thanks to @IsmaelMiguel.

f=(n,m)=>{with(d.style)width=n*25+'px',height=m*25+'px'}
<input id=w placeholder=width><input id=h placeholder=height><input type=button value=Go! onclick=f(w.value,h.value)>
<div id=d style="border-image:radial-gradient(#fff 0,#fff 0)0 fill/25px;background:radial-gradient(#000 0,#000 8px,#fff 9px)0 0/25px 25px">