Replacing empty paragraph using preg_replace, whitespace not recognized
By : user2851136
Date : March 29 2020, 07:55 AM
may help you . It's indeed the UTF-8 encoding 11000010 10100000 of NBSP \xA0. As said earlier, this works: code :
= preg_replace('/<p>\p{Z}*<\/p>/u', '<p class="notmobile"> </p>', $f);
|
PHP Preg_replace() pattern to replace only proper text and not image alt/src text
By : RisAbd
Date : March 29 2020, 07:55 AM
wish helps you I'm trying to replace first occurrence of the string "Harvey" with the link Harvey , Try using: code :
Harvey(?![^<>]*>)
Harvey(?=[^<>]*(?:<|\Z))
"/".$internal_links_row['key_phrase']."(?![^<>]*>)/i"
"/".$internal_links_row['key_phrase']."(?=[^<>]*(?:<|\Z))/i"
"~".$internal_links_row['key_phrase']."(?=[^<>]*(?:<(?!/a)|\Z))~i"
^ ^^^^^^ ^
|
preg_replace error with regex with non-english characters, character is not recognized
By : Smith Smith
Date : March 29 2020, 07:55 AM
I wish this help you By default the PHP regex engine considers your string as a suit of bytes (i.e. as a suit of one byte characters). When you use the u modifier, the regex engine changes two things: code :
(*UTF8)(*UCP)yourpattern
|
How to get font sizes of recognized text to Recognize Name using font size on the Business Card form the Recognized text
By : Duke_of_Styria
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have implemented Business Card Reader App for iPhone using OCR by , Just try this -
|
text is recognized when i click the picture very closely. it is not even recognizing the text on a business card
By : Jaymo Burna
Date : March 29 2020, 07:55 AM
I wish this helpful for you You should not use photo capture like this. According to documentation - extras.get("data") contains small preview and should not be used for other purposes then showing preview. You should use camera the other way. There is a Kotlin sample from my library. It creates file in DCIM dir and pass to Camera it's URI to use as output: code :
private fun takePhoto() {
val photoIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
val dirDCIM = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
val storageDir = File(dirDCIM, "/${config.cameraFolderName}/")
if (!storageDir.exists()) storageDir.mkdirs()
currentCameraImageFile = File(storageDir, "photo_${UUID.randomUUID()}.jpg")
val uri =
FileProvider.getUriForFile(this, "$packageName.fileprovider", currentCameraImageFile!!)
photoIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri)
val resolvedIntentActivities =
packageManager.queryIntentActivities(photoIntent, PackageManager.MATCH_DEFAULT_ONLY)
for (resolvedIntentInfo in resolvedIntentActivities) {
val packageName = resolvedIntentInfo.activityInfo.packageName
grantUriPermission(
packageName,
uri,
Intent.FLAG_GRANT_WRITE_URI_PERMISSION or Intent.FLAG_GRANT_READ_URI_PERMISSION
)
}
startActivityForResult(photoIntent, PHOTO_REQUEST_CODE)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
when (requestCode) {
PHOTO_REQUEST_CODE -> {
val photoFile = currentCameraImageFile ?: return
if (resultCode == Activity.RESULT_OK && photoFile.exists()) {
// Do your stuff
} else {
// If result is not successful - delete temporary photo file
photoFile.delete()
}
currentCameraImageFile = null
}
}
}
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/imagepicker_file_paths" />
</provider>
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="imagepicker_images"
path="." />
</paths>
|