473,700 Members | 2,699 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

corrupt images

20 New Member
Hi, Ive been pulling my hair on this one -- who hasnt. Im encoding a jpg using the JPGEncoder and the same code that is out there on the internet.

AS:
Expand|Select|Wrap|Line Numbers
  1. var jpgSource:BitmapData = new BitmapData (sw, sh);
  2.             jpgSource.draw(root);
  3.             var namae:String = TITLE.replace(/[\s]/g, "-");
  4.             var jpgEncoder:JPGEncoder = new JPGEncoder(90);
  5.             var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
  6.             var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
  7.             var jpgURLRequest:URLRequest = new URLRequest(URL+"download.php?name="+namae+".jpg");
  8.             jpgURLRequest.requestHeaders.push(header);
  9.             jpgURLRequest.method = URLRequestMethod.POST;
  10.             jpgURLRequest.data = jpgStream;
  11.             navigateToURL(jpgURLRequest, "_top");
  12.  
PHP:
Expand|Select|Wrap|Line Numbers
  1. if (isset( $GLOBALS["HTTP_RAW_POST_DATA"])) {
  2.     $jpg = $GLOBALS["HTTP_RAW_POST_DATA"];
  3.     header('Content-Type: image/jpeg');
  4.     header("Content-Disposition: attachment; filename=".$_GET['name']);
  5.     echo $jpg;
  6. } else {
  7.     echo "An error occured.";
  8. }
  9.  
for some reason, I seem to be the only one in the world who this happens to. About half the time, the image appears as half rendered. Youll see half the stage fine but the other half looks likes its still being drawn out. Ive seen it still green, magenta, gray, all the colors of the rainbow. When I try to load the image in photoshop, it says that the image is corrupted. Im stuck using CS3 for right now, so I still have to bounce downloads off the server. Can anyone offer any insight? I cant tell if its the actual byteArray or if its on the server side. I have no idea where to start to debug this. Please someone help me!
Thanks in advance!!
Dec 9 '09 #1
0 1395

Sign in to post your reply or Sign up for a free account.

Similar topics

7
14249
by: deko | last post by:
I need to allow users to download files from a directory that is not publicly accessible. To do this, I use a download script: header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=".$filename); readfile($fullpath); I've also tried using header("Content-Type: application/force-download") instead of header("Content-Type: application/octet-stream"), but get the same results - the downloaded...
5
3197
by: Vinay | last post by:
Hi I have a corrupt word file. I am able to open it with the code given below tr Dim pInfo As System.Diagnostics.ProcessStartInfo = New System.Diagnostics.ProcessStartInfo( pInfo.UseShellExecute = Tru pInfo.FileName = "c:\corrupt.doc Dim p As Process = System.Diagnostics.Process.Start(pInfo Catch ex As Exceptio MsgBox(ex.ToString End Tr
0
1979
by: Filips Benoit | last post by:
A particular form - always the same - sometimes becomes corrupt after saving. Error msg = The expression On Open you entered as the event property settings produced the following error: A problem occurred while 'DB-name' was communicating with the ole server or ActiveX controle. The form has a calendar-controle. I have eliminated the code in the OnOpen-event but the form stays corrupt!
9
2480
by: Bungle | last post by:
Hi There, Does anybody know where i might be able to locate a tool/application that can determine whether a Database is corrupt?? Also, can a bad network connection cause a corruption to a database? Thanks in advance for any help, Bungle
4
1931
by: dixie | last post by:
I have come across some code to walk through the records of a corrupt table and copy it record by record to a new table. It comes from the MVPS.Org site and is as follows. ----------------------- (Q) How can I recover records from a corrupt table? (A) First, using Access while in the database window, copy the table's structure only from the corrupt table, if possible. Then using the code below, copy each individual row from the old...
1
1213
by: apoorv | last post by:
Hi guys, I am writing a imaging aplication on VC++.I have to display images and apply effects onto it.Images could be of any type like jpg,gif,bmp,psd... I am using createDibSection API.it requires BITMAPINFO struc as one of its parameters.Its working well(Images are successfully displayed) but my problem is that in certain images(of any type)they are skewed and becomes B/W(means Data corruption).U can see my code of populating...
0
2330
by: Fredo | last post by:
I have an app that I'm writing to manage jpgs. Sometimes the photos are corrupt. If I use something like ACDSee, it will show the image, but it will have a note in the status bar that the image is corrupt, and it says, specifically, "The source datastream is corrupt." I'd like to be able to detect this as well with C#, but the Image.FromFile() method returns the image and I can't see any way to determine if it's corrupt. Is this simply...
7
10495
by: eventuranza | last post by:
For my application, there users can upload and download files to the a webserver. Straightforward enough. However, when they upload a PDF file then try to download it, the file seems to be corrupted. The had not been a problem before but it seems to have been introduced when I refactored the writing to the response to a buffered version to prevent potential OutOfMemoryExceptions (you wouldn't believe the size of some of these...
3
2206
by: rdemyan via AccessMonster.com | last post by:
One of my users had a corrupt front end that wouldn't open. My app is launched using a launching application (logon app). The logon app has a button for downloading a "fresh" copy of the front end from the server to the user's PC. I thought that this was a good idea since Access seems susceptible to corruption. I told the user to open the logon form and click the "Download" button, which would then replace the corrupt front end on his...
8
2774
by: iheartvba | last post by:
Hi this is a query made using access query builder: SELECT tblBank.BankID, Now() AS TimeRecd, Val(Right(nz(,0),3)) AS ConsID, "AutoCASH" AS RecUser, tblBank.Dt, Forms!frmRecCASHRunningBal!tbGroup AS GroupID FROM tblBank WHERE (((tblBank.Dt)>(!!-1) And (tblBank.Dt)<(!!+1))); 1.tblBank has a record in the Dt field which equals = 02/07/08 2. tbBankMinDate -1 = 01/07/08 3. tbBankRecDate + 1 = 03/07/08
0
8713
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8639
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9203
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4650
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2379
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2021
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.