Questions about JPG data addition: Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiMultimedia/html/delphi_2006121213540567.html
I want to add some data to a specified location. How can I do this by programming? Thank you!
For the following data, I think each image has this data.
Bytes
It is easy to add the image, that is, it is afraid that the jpg image will change.
This section is also included in JPG format. No, now you only need to solve how to insert it. Can you help me?
Let me talk about the process.
Mount the JPG file into the memory stream M1
Then, import the content of the first half of M1 to the memory stream
Write the part of the data you want to add to M2.
Add the second half of the image to M2.
In this process, pay attention to the position of the current pointer of the stream. Otherwise, an error occurs.
Loadfromfile ()
Right after learning, I will take this opportunity to ask you a question <% @ page contenttype = "text/html; charset = GBK"
Import = "Java. SQL. *" %>
<% Request. setcharacterencoding ("gb2312 ");
Com. Prime. DB. dbtrans mydb = new COM. Prime. DB. dbtrans ();
Try {
String strsql = "select * from (select picpath, picid, pictitle from m_picture"
+ "Where classid = '04 'and lan_flag = '1' and picstus = '2' order by picid DESC) Where rownum <= 5 ";
Resultset rs1_mydb.exe cutequery (strsql );
%>
<! -- Rolling image data begin -->
<Style type = "text/CSS">
. Rollpic {
Border: 1px solid #999999;
Padding: 4px 4px 4px 4px;
Background-color: # FFF;
Overflow: hidden;
}
. Rolltitle {color: # FFF; line-Height: 19px ;}
</Style>
<Table width = "575" border = "0" cellspacing = "0" cellpadding = "0" align = center>
<Tr>
<TD bgcolor = "# eaeaea" align = center>
<Div id = demo style = "overflow: hidden; width: 550px; Height: 145px; margin-top: 5px;">
<Table cellspacing = 0 cellpadding = 0 border = 0>
<Tr>
<TD id = demo1> <Table cellspacing = 0 width = 100%>
<Tr>
<% Boolean bnotfound = true;
Int I = 1;
While (Rs. Next ()){
Bnotfound = false;
String strpicpath = Rs. getstring ("picpath ");
String strpicid = Rs. getstring ("picid ");
String strpictitle = Rs. getstring ("pictitle ");
%>
<TD> <Table>
<Tr>
<TD class = rollpic> </a> </TD>
</Tr>
<Tr Height = '24'>
<TD class = rollpic align = "center" valign = "Middle"> <a target = "_ blank" href = "/en/public/entpjjshow. jsp? Picid = <% = strpicid %> ">
<% = Strpictitle. Length ()> 14? Strpictitle. substring (0, 14) + "... ": Strpictitle %>
</A> </TD>
</Tr>
</Table> </TD>
<% I ++;
}
%>
</Tr>
</Table>
<% IF (bnotfound) {%>
<Table width = "100%" Height = "100%">
<Tr>
<TD class = rollpic align = "center" valign = "Middle"> no picture is recommended. </TD>
</Tr>
</Table>
<% }%>
<%} Catch (exception ex ){
} Finally {
Try {
Mydb. Close ();
Mydb = NULL;
} Catch (exception ex ){}
} %>
</TD>
<TD id = demo2> </TD>
</Tr>
</Table>
</Div> </TD>
</Tr>
<Tr>
<TD align = "right" valign = "TOP" bgcolor = "# eaeaea"> <a href = "/en/tpjj. JSP "target =" _ blank "> more... </a> </TD>
</Tr>
</Table>
<SCRIPT>
VaR speed = 40 // The greater the speed, the slower the speed.
Demo2.innerhtml = demo1.innerhtml
Function marquee (){
If (demo2.offsetwidth-demo. scrollleft <= 1)
Demo. scrollleft-= demo1.offsetwidth
Else {
Demo. scrollleft ++
}
}
VaR mymar = setinterval (marquee, speed)
Demo. onmouseover = function () {clearinterval (mymar )}
Demo. onmouseout = function () {mymar = setinterval (marquee, speed )}
</SCRIPT>
<! -- Rolling image data end --> This section Program Is to call images from the database. If I want to call a .jpg file from a specified directory, how can I write the file? (dynamic call means reading the file directly from this directory), for example, D: \ images. Calling images without calling the file from the database can tell me.
Many methods
For more information, see jepg format.
Thank you. Let's take a look at the operation flow.
There is a tool named hide in picture...
Similar filtering methods can be used.
How can I get the second half of M1?
There are many ways
Memorystream1.write (pointer (INTEGER (memorystream. Memory + memorystream. Position) ^, memorystream. Size-MemoryStream.Position );
You can also move the current location, read the remaining bytes into the dashboard, and then write
Thanks !!!