|
|
|
@ -3603,6 +3603,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
|
|
|
|
|
replaceAll(tmpPath, "/photos/", "/tmp/");
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
// Save photo to temporary file and then rename to right path
|
|
|
|
|
bool res = cv::imwrite(tmpPath.c_str(), mat, params);
|
|
|
|
|
size_t imgFileSize = getFileSize(tmpPath);
|
|
|
|
|
if (res && imgFileSize > 0)
|
|
|
|
@ -3618,27 +3619,6 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
|
|
|
|
|
bool res = cv::imwrite(fullPath.c_str(), mat, params);
|
|
|
|
|
size_t imgFileSize = getFileSize(fullPath);
|
|
|
|
|
#endif
|
|
|
|
|
#if 0
|
|
|
|
|
std::string bakPath = fullPath;
|
|
|
|
|
replaceAll(bakPath, "/photos/", "/backup/");
|
|
|
|
|
// cv::imwrite(bakPath.c_str(), mat, params);
|
|
|
|
|
|
|
|
|
|
vector<unsigned char> inImage;
|
|
|
|
|
imencode(".jpg", mat, inImage);
|
|
|
|
|
|
|
|
|
|
size_t bytesWrtten = 0;
|
|
|
|
|
if (!inImage.empty())
|
|
|
|
|
writeFile((bakPath + ".dat"), (const unsigned char*)&inImage[0], inImage.size());
|
|
|
|
|
|
|
|
|
|
bytesWrtten = getFileSize(bakPath + ".dat");
|
|
|
|
|
|
|
|
|
|
// #ifdef _DEBUG
|
|
|
|
|
size_t photoFileSize = getFileSize(fullPath);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Photo File %s Size=%u BufSize=%u DataFileSize=%u", fullPath.c_str() + m_appPath.size(), (uint32_t)photoFileSize,
|
|
|
|
|
(uint32_t)inImage.size(), (uint32_t)bytesWrtten);
|
|
|
|
|
// #endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Failed to Write File: %s", fullPath.c_str() + m_appPath.size());
|
|
|
|
|