php如何把图片存进oracle

php如何把图片存进oracle数据库
从服务器得到了图片的url 怎么把他存进oracle里面

只能服务端连oracle数据库保存

将图片转化为二进制流

public static byte[] change_to_Stream(String path) {
        byte[] imageBytes = null;
        try (FileInputStream fileInputStream = new FileInputStream(new File(path));) {
            imageBytes = new byte[fileInputStream.available()];
            fileInputStream.read(imageBytes);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return imageBytes;
    }

将二进制流输出到图片中

public static void change_to_Image(byte[] imageBytes, String newPath) {
    //在这里直接用try-with-resourse,可以不用手动关闭资源
        try (FileOutputStream fileOutputStream = new FileOutputStream(new File(newPath));) {
            fileOutputStream.write(imageBytes);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

通过将图片转化为二进制之后,可以把这个二进制存进数据中

如果把整个图片存进数据库,可以把图片以二进制的方式进行储存!