Yeah! you should detect the browser! The navigator object contains all the information you need. http://web-design-lessons.com/articles/article/1/JavaScript%20Browser%20Detection
First of all you should create an image instance. e.g. $img = Imagecreatefromjpeg('path/image.jpg'). After you can do everything with this image instance $img. It does not matter to re-size first or...
You should learn the basics. It's not difficult to learn only HTML and CSS. It'll take 5-10 days to do this.
Visit this and other articles. There is small course of HTML and CSS