5){ //image files must end with .jpg, .jpgeg or .png $ext = substr(strrchr($file, '.'), 1); if(strtoupper($ext) == "JPG" || strtoupper($ext) == "JPEG" || strtoupper($ext) == "PNG"){ $JSON .= "\n{\"itemId\":\"" . strtoupper(fnCreateGuid()) . "\","; $JSON .= "\"itemType\":\"BT_imageItem\", "; $JSON .= "\"imageName\":\"" . $file . "\","; $JSON .=" \"imageURL\":\"http://www.yoursite.com/imageFolder/" . $file . "\"},"; } } } } } //remove the comma after last image so JSON is valid $JSON = trim($JSON); if(substr(strtoupper($JSON), (strlen($JSON) - 1), 1) == ","){ $JSON = substr($JSON, 0, strlen($JSON) - 1); } //end the JSON $JSON .= "\n]}"; //print the output echo $JSON; exit(); ?>