Skip to content

Commit

Permalink
Merge pull request #9 from Vizzuality/feature/local-image-extension
Browse files Browse the repository at this point in the history
Local tiles as pattern test png and jpg
  • Loading branch information
sorodrigo authored Jul 25, 2017
2 parents e72b332 + 4755c06 commit ff2faad
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ public Tile getTile(int x, int y, int zoom) {
File myFile = new File(dir + "/" + pathUrl);

try {
image = BitmapFactory.decodeFile(myFile.getAbsolutePath(), options);
image = BitmapFactory.decodeFile(myFile.getAbsolutePath() + ".png", options);
} catch (Exception e) {
e.printStackTrace();
return NO_TILE;
}

if (image == null) {
try {
image = BitmapFactory.decodeFile(myFile.getAbsolutePath() + ".jpg", options);
} catch (Exception e) {
e.printStackTrace();
return NO_TILE;
}
}

if (image != null) {
Bitmap finalBitmap = Bitmap.createBitmap(image , 0 , 0, this.width, this.height);
stream = new ByteArrayOutputStream();
Expand Down

0 comments on commit ff2faad

Please sign in to comment.