I’m sending a full size bitmap (500×500) in base 64 string to a PHP server. When I received the data, I want to decode it and generate two JPEGS: one in the original size, and one smaller (thumbnail). Here’s my original code:
<?php
$base=$_POST['originalImage']; // Bitmap in 500x500
$binary=base64_decode($base);
// ?? How to generate binary for bitmap in 200x200?
?>
Save that binary string to the server as a file and then do a google search. You’ll find tons of tutorials that also include sample code you can copy and paste like that one http://webcheatsheet.com/php/create_thumbnail_images.php
If you want to do it properly I suggest you to use https://github.com/avalanche123/Imagine which is a very nice php 5.3 OOP image manipulation lib that works with different engines.
Here is a dead easy sample for thumbnail generation with Imagine: