Skip to content

Commit

Permalink
Merge pull request #2 from tobozo/1.0.3
Browse files Browse the repository at this point in the history
1.0.3
  • Loading branch information
tobozo authored Aug 10, 2021
2 parents 7c4105e + 4b34928 commit c35e3a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32-imgur-uploader
version=1.0.2
version=1.0.3
author=tobozo
maintainer[email protected]
sentence=imgur.com Image/Video uploader
Expand All @@ -9,4 +9,4 @@ url=https://github.com/tobozo/ImgurUploader/
architectures=esp32
includes=ImgurUploader.h
depends=ArduinoJSON

13 changes: 9 additions & 4 deletions src/ImgurUploader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define IMGUR_UPLOAD_API_URL "/3/image"
#define IMGUR_UPLOAD_API_DOMAIN "api.imgur.com"
#define IMGUR_URL_MASK "https://imgur.com/%s"
#define IMGUR_BUFFSIZE 512
#define IMGUR_BUFFSIZE 4096
#define BOUNDARY "blah-blah-oz"
#define HEADER "--" BOUNDARY
#define FOOTER "--" BOUNDARY "--"
Expand Down Expand Up @@ -69,13 +69,13 @@ int ImgurUploader::uploadFile( fs::FS &fs, const char* path ) {
const char* fileName = _sourceFile.name();
_arrayLen = _sourceFile.size();
const char* mimeType = getMimeType( fileName );
return upload( fileName, mimeType );
return upload( fileName, mimeType );
}


int ImgurUploader::uploadBytes( const uint8_t* byteArray, size_t arrayLen, const char* imageName, const char* imageMimeType ) {
_source = SOURCE_BYTE_ARRAY;
_byteArray = (uint8_t*)_byteArray;
_byteArray = (uint8_t*)byteArray;
_arrayLen = arrayLen;
const char* mimeType = getMimeType( imageName );
//String fileName = String( imageName );
Expand Down Expand Up @@ -137,7 +137,11 @@ int ImgurUploader::upload( const char* imageName, const char* imageMimeType ) {


void ImgurUploader::sendImageData() {
uint8_t buf[IMGUR_BUFFSIZE];
uint8_t *buf = (uint8_t*)calloc( IMGUR_BUFFSIZE+1, sizeof(uint8_t) );
if( buf == NULL ) {
log_e("Can't alloc %d bytes, aborting", IMGUR_BUFFSIZE+1);
return;
}
size_t packets = 0;
size_t _progress = 0;
switch( _source ) {
Expand Down Expand Up @@ -193,6 +197,7 @@ void ImgurUploader::sendImageData() {
}
break;
}
free(buf);
}


Expand Down

0 comments on commit c35e3a0

Please sign in to comment.