aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/LoadImageURL
diff options
context:
space:
mode:
authorJeff Ames2009-05-31 18:35:00 +0000
committerJeff Ames2009-05-31 18:35:00 +0000
commit35b450d41d2695aa6a82a6d8e6bda5e327f431e1 (patch)
tree28028806a736a8f22b41ab0c7c8feec1f43fd0f9 /OpenSim/Region/CoreModules/Scripting/LoadImageURL
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-35b450d41d2695aa6a82a6d8e6bda5e327f431e1.zip
opensim-SC_OLD-35b450d41d2695aa6a82a6d8e6bda5e327f431e1.tar.gz
opensim-SC_OLD-35b450d41d2695aa6a82a6d8e6bda5e327f431e1.tar.bz2
opensim-SC_OLD-35b450d41d2695aa6a82a6d8e6bda5e327f431e1.tar.xz
Add copyright headers, formatting cleanup, ignore some generated files.
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/LoadImageURL')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs86
1 files changed, 43 insertions, 43 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
index 61c37b9..5b326d4 100644
--- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -166,7 +166,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
166 RequestState state = (RequestState) result.AsyncState; 166 RequestState state = (RequestState) result.AsyncState;
167 WebRequest request = (WebRequest) state.Request; 167 WebRequest request = (WebRequest) state.Request;
168 Stream stream = null; 168 Stream stream = null;
169 byte[] imageJ2000 = new byte[0]; 169 byte[] imageJ2000 = new byte[0];
170 170
171 try 171 try
172 { 172 {
@@ -174,51 +174,51 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
174 if (response != null && response.StatusCode == HttpStatusCode.OK) 174 if (response != null && response.StatusCode == HttpStatusCode.OK)
175 { 175 {
176 stream = response.GetResponseStream(); 176 stream = response.GetResponseStream();
177 if(stream != null) 177 if (stream != null)
178 { 178 {
179 Bitmap image = new Bitmap(stream); 179 Bitmap image = new Bitmap(stream);
180 Size newsize; 180 Size newsize;
181 181
182 // TODO: make this a bit less hard coded 182 // TODO: make this a bit less hard coded
183 if ((image.Height < 64) && (image.Width < 64)) 183 if ((image.Height < 64) && (image.Width < 64))
184 { 184 {
185 newsize = new Size(32, 32); 185 newsize = new Size(32, 32);
186 } 186 }
187 else if ((image.Height < 128) && (image.Width < 128)) 187 else if ((image.Height < 128) && (image.Width < 128))
188 { 188 {
189 newsize = new Size(64, 64); 189 newsize = new Size(64, 64);
190 } 190 }
191 else if ((image.Height < 256) && (image.Width < 256)) 191 else if ((image.Height < 256) && (image.Width < 256))
192 { 192 {
193 newsize = new Size(128, 128); 193 newsize = new Size(128, 128);
194 } 194 }
195 else if ((image.Height < 512 && image.Width < 512)) 195 else if ((image.Height < 512 && image.Width < 512))
196 { 196 {
197 newsize = new Size(256, 256); 197 newsize = new Size(256, 256);
198 } 198 }
199 else if ((image.Height < 1024 && image.Width < 1024)) 199 else if ((image.Height < 1024 && image.Width < 1024))
200 { 200 {
201 newsize = new Size(512, 512); 201 newsize = new Size(512, 512);
202 } 202 }
203 else 203 else
204 { 204 {
205 newsize = new Size(1024, 1024); 205 newsize = new Size(1024, 1024);
206 } 206 }
207 207
208 Bitmap resize = new Bitmap(image, newsize); 208 Bitmap resize = new Bitmap(image, newsize);
209 209
210 try 210 try
211 { 211 {
212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 212 imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
213 } 213 }
214 catch (Exception) 214 catch (Exception)
215 { 215 {
216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); 216 m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
217 } 217 }
218 } 218 }
219 else 219 else
220 { 220 {
221 m_log.WarnFormat("[LOADIMAGEURLMODULE] No data returned"); 221 m_log.WarnFormat("[LOADIMAGEURLMODULE] No data returned");
222 } 222 }
223 } 223 }
224 } 224 }
@@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
228 } 228 }
229 finally 229 finally
230 { 230 {
231 if(stream != null) 231 if (stream != null)
232 { 232 {
233 stream.Close(); 233 stream.Close();
234 } 234 }