English 中文(简体)
• 如何在海山一旁产生生态影响[blob-> * png或jpg]
原标题:How to generate Image at server side in java [ blob-> string_image -> *.png or .jpg ]

我希望在服务器方面产生形象。 我的图像储存在一个服务器数据库中,以博览格式,我能够将其转换成扼杀性。 然后,我如何将这种扼杀——im化转化为实际的jpg或png格式?

Actually I am posting attachment as image on users facebook wall. How to generate the image at server side in Java? Is there any sample code to do it?

最佳回答

如果你在Blob格式上有形象,那么你最好用图像IO,并直接阅读Blob投入。

这将给你一个 j。 变形 图像标本,然后用图象仪向任何类型的图像提供。 作为输出国小组,你可以把这个机构/机构归来。

BufferedImage image = ImageIO.read( blob.getInputStream() );
// Feel free to modify the image here using image.createGraphics()
// add a water mark if you re feeling adventurous
byte[] responseBody = toByteArray( image, "png" );

....    
protected byte[] toByteArray(BufferedImage image, String type) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageIO.write(image, type, baos);
    return baos.toByteArray();
}

我不熟悉脸谱如何使用图像。 我认为,这取决于你重新做些什么。 关于面对面的申请,我认为你仍然负责接收图像,但脸书将作为 proxy子,仅一次要求图像,然后向需要看到图像的所有客户提供服务。 如果一个用户张贴图像,那么我认为脸书完全储存图像(很明显,一个用户上传照片,通常没有另一个服务器)。

如果你根据网络要求只想显示“象现在一样”的形象,那么,你可以直接把布布布局的产出交给客户,尽管这把数据库链接开放给客户,但你可能会更好地复制到一个磁盘,然后向客户提供服务。

我不得不坦白,我看不出什么东西可以帮助tir死的人实际上是什么? 也许你可以澄清,这一答案是否满足了你的需要。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签