 <p>I did the same as in this <a href="http://stackoverflow.com/a/6401135/262462">http://stackoverflow.com/a/6401135/262462</a> but edited this part</p> <pre><code>function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) { // do this or they'll all go to jpeg $image_type=$this-&gt;image_type; </code></pre> <p>to this</p> <pre><code>function save($filename, $image_type="original", $compression=75, $permissions=null) { if ($image_type=="original") $image_type=$this-&gt;image_type; </code></pre>