20
20
You should have received a copy of the GNU Affero General Public License
21
21
along with this program. If not, see <http://www.gnu.org/licenses/>.
22
--------------------------------------------------------------------------
24
This file, as a standalone file is also avalible under GNU Lesser General
25
Public License either version 3 of the License, or (at your option) any
23
29
include "php/db.php";
30
include "php/stupid_image.php";
26
33
"iVBORw0KGgoAAAANSUhEUgAAARgAAAEYCAYAAACHjumMAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
181
188
Y4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOMMcYYY4wxxhhjjDHGGGOM
182
189
McYYY4wxxhhjjDFj8v+EX5l2R3A63QAAAABJRU5ErkJggg==";
184
192
header("Content-type: image/png");
185
193
if(isset($_GET['userName']) ){
186
194
$username = $_GET['userName'];
190
198
$fetch = $tuples->fetchAll();
191
199
//var_dump($fetch);
192
200
if(count($fetch) > 0 && $fetch[0]['profileImage'] != "" ) {
193
echo(base64_decode($fetch[0]['profileImage']));
201
$image = new Imagick();
202
$image->readImageBlob(base64_decode($fetch[0]['profileImage']));
203
$imageprops = $image->getImageGeometry();
204
/*var_dump($imageprops);
205
if ($imageprops['height'] > 280 || $imageprops['width'] > 280){
206
$image->resizeImage(280,280);
207
} else if ($imageprops['height'] < 280 || $imageprops['width'] < 280) {
208
if ($imageprops['height'] = $imageprops['width'] ) {
209
$image->resizeImage(280,280, imagick::FILTER_LANCZOS, 0, false);
210
} else if ($imageprops['height'] > $imageprops['width'] ){
211
$image->resizeImage(280,0, imagick::FILTER_LANCZOS, 0, false);
212
} else if ($imageprops['height'] < $imageprops['width'] ){
213
$image->resizeImage(0, 280, imagick::FILTER_LANCZOS, 0, false);
215
$image->cropImage(280,280,0,0);
219
$img = stupid_rescale_and_crop($image, 280, 280);
220
$img->setImageFormat("png");
195
223
echo base64_decode($def);