Git Product home page Git Product logo

Comments (2)

xstar97 avatar xstar97 commented on June 9, 2024

this was never closed...so just offering more advice.

create a public static boolean method to check the image file extension before its being uploaded & if it returns true then continue on in the process..however if it returns false...issue a toast or dialog message stating its the wrong file...but...if the file can be converted beforehand I think that would be a better option.
such as: very rough example & can be better
(i would suggest to use an asynctask)
public static void convert2PNG(filename){
try {
FileOutputStream out = new FileOutputStream(filename);
bmp.compress(Bitmap.CompressFormat.PNG, 100, out); //100-best quality
out.close();
} catch (Exception e) {
e.printStackTrace();
}
}
//is image a png?
public static boolean isPNG(File file/String string){
File f = new File(file);
String s = string;
String ext = f.getAbsolutePath().substring(f.getAbsolutePath().lastIndexOf("."));
//or
String ext = s.substring(s.lastIndexOf("."));

if(ext.equalsIgnoreCase("png"){
return true;
}else{
return false;
}
if you allow users to use their own banners/logos then you should convert the images to PNG to make it easier for your users & speed up the process even further if they downloaded the wrong format.

from tvapprepo.

Fleker avatar Fleker commented on June 9, 2024

This was meant more for my own generating mechanism. Since we've moved away from that, this can be closed without fix

from tvapprepo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.