Getting negative results from calculations
analogRead() returns a number from 0 to 1023, and you want to convert that to a range from 0 to 255? One easy way would be to simply divide the reading by 4.

On a more general note, given that the numbers will (should!) never be negative, there's a flavour of int called unsigned int. By using that:

unsigned int val = analogRead(...);


you can cover a range from 0 to 65535 instead of int's -32768 to 32767. That will give you a little more head room - but not enough to multiply the maximum value 1023 by 255 first.

There's also another type long. That covers the range from -2 to 2 billion (and a bit), while unsigned long goes from 0 to 4 billion (and a bit) - but that uses a LOT of processing for the poor Arduino to work with.