= '300000') { return false; } /* step through inArray */ foreach ($inArray as $key => $val) { if (is_array($val)) { /* recurse on array elements */ $newArray[$key] = utf8json($val); } else { /* encode string values */ $newArray[$key] = utf8_encode($val); } } /* return utf8 encoded array */ return $newArray; } /* return utf8 encoded array */ return $inArray; } function returnJsonWithDecode($app, $callbackFn, $retObj) { if ($callbackFn) { $app->contentType('application/javascript; Charset=UTF-8'); echo $callbackFn . "(" . html_entity_decode(json_encode(utf8json($retObj)), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1') . ")"; } else { $app->contentType('application/x-json; Charset=UTF-8'); echo html_entity_decode(json_encode(utf8json($retObj)), ENT_COMPAT | ENT_HTML401, 'ISO-8859-1'); } } function returnJson($app, $callbackFn, $retObj) { if ($callbackFn) { $app->contentType('application/javascript; Charset=UTF-8'); echo $callbackFn . "(" . (json_encode(utf8json($retObj))) . ")"; } else { $app->contentType('application/x-json; Charset=UTF-8'); echo (json_encode(utf8json($retObj))); } } function makeThumbnail($im) { $final_width_of_image = 300; $ox = imagesx($im); $oy = imagesy($im); $nx = $final_width_of_image; $ny = floor($oy * ($final_width_of_image / $ox)); $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm, $im, 0, 0, 0, 0, $nx, $ny, $ox, $oy); return $nm; } function getContentFromResources($res) { ob_start(); //Start output buffer. imagejpeg($res); //This will normally output the image, but because of ob_start(), it won't. $contents = ob_get_contents(); //Instead, output above is saved to $contents ob_end_clean(); //End the output buffer. return $contents; } ?>