The two blocks of code below are functionally equivalent, as
explained above.
[C#]
XImageLoadOptions loadOptions = new XImageLoadOptions();
loadOptions.ReadExif = true;
XImage image = XImage.FromFile(Server.MapPath("rez/myexif.jpg"), loadOptions);
if (image.Exif != null) {
foreach (ExifRecord exifrec in image.Exif) {
Response.Write(exifrec.Name + ":" + exifrec.Value + "<br>");
}
}
image = XImage.FromFile(Server.MapPath("rez/myimg.jpg"), loadOptions);
if (image.Exif != null) {
for (int i = 0; i < image.Exif.Count; i++) {
Response.Write(image.Exif[i].Name + ":" + image.Exif[i].Value + "<br>");
}
}
[Visual Basic]
Dim loadOptions As New XImageLoadOptions()
loadOptions.ReadExif = True
Dim image As XImage = XImage.FromFile(Server.MapPath("rez/myexif.jpg"), loadOptions)
If image.Exif IsNot Nothing Then
For Each exifrec As ExifRecord In image.Exif
Response.Write((exifrec.Name & ":") + exifrec.Value & "<br>")
Next
End If
image = XImage.FromFile(Server.MapPath("rez/myimg.jpg"), loadOptions)
If image.Exif IsNot Nothing Then
For i As Integer = 0 To image.Exif.Count - 1
Response.Write((image.Exif(i).Name & ":") + image.Exif(i).Value & "<br>")
Next
End If
|