473,750 Members | 2,616 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 1398

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

Similar topics

7
14253
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
3202
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
1991
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
2484
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
1215
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
2343
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
10498
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
2208
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
2777
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
9000
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
9577
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...
0
9396
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9256
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...
1
6804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4713
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
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
3
2225
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.