c – Retrieve the file format by checking the file header

I write a program, part of which is to determine if a particular file is a PNG file. Since I knew that a file does not need to be named with the appropriate file name extension to have a specific type, I decided to check the header of the file. After I did not think of anything better, I wrote this if statement with a lot of &&

uint8_t buffer[sizeof(uint8_t) * size];
int fileType;

if (fread (buffer, size of (uint8_t) * size, 1, fp) == 1) {

if (buffer[0] == 137 && buffer[1] == 80 &&
buffer[2] == 78 && buffer[3] == 71 &&
buffer[4] == 13 && buffer[5] == 10 &&
buffer[6] == 26 && buffer[7] == 10)
File type = PNG;

}

size was before and determined PNG is from one enum Type, if there is any confusion.

I tried to use the header bits of the PNG file format as a macro, but it seemed way too complicated (due to the way they are read into a buffer) to check if the bits of the given file are using this Macro are identical. I also tried using strings, but it also seemed a lot more complicated.

I was wondering, how would you change that? Or, since there is probably a better way, how else could I check if the PNG header exists in a particular file?