![]() |
php image upload problem
i'm building a tgp script, i have a problem with the thumbnails, they come out distorted.
here is the code: PHP Code:
|
Could be something in the PHP library??
:helpme |
Quote:
what could it be in the PHP library? |
any ideas?
|
bump for ya
|
is the directory you're copying to chmod to 777?
Does the form have the proper encode type? |
You should check out PHP freaks forums, I'm sure guys there will help ya
|
Suggestion: Copy the file with a .phps extension and put it someone where people can click a link to see it. GFY's 'hahahaha' filter makes it really difficult to understand what you're trying to do.
FWIW - Filtering based on filename isn't as reliable as GetImageSize() to determine if a file is really a jpg or not. :2 cents: |
Quote:
Quote:
|
Quote:
|
Quote:
|
Quote:
I'm just using the above script, not resizing or anything. just uploading. after upload, I try to look at the image via browser as: http://mydomain.com/myimage.jpg and there it is. distorted. I already emailed my host (revsharehosting.com) about this, but if I could only tell him what he can do to fix this, because if doesn't - I don't and i'm fucked. |
here is the form by the way:
[HTML] <form name="form1" method=hahahahahaha action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <input type="submit" name="Submit" value="Submit"> </form> [/HTML] |
Can you post links to the before and after? There definately sounds like some kind of corruption is going on, I'm curious to see what's happening to the image itself.
|
the response from the host is that GD is needed for this
what do you guys think about that? |
i think this is something to do with the type of the file (Binary / Ascii)
how do I set those on upload or move ? |
GD isn't required for file uploads, only for times when you want to do things like GetImageSize(). If you're purely shuffling bytes around, you don't need it.
Binary/Ascii only should apply when dealing with FTP transfers. Web-based uploads don't have the same caveats (or at least they shouldn't!), but that's part of the reason why I wanted to see a before image and an after image, so I could see if there was some sort of corruption going on during the upload phase. |
Quote:
here is a "before": (used upload via php) http://footfetishgallery.net/gallery/thumbnails/04.jpg here is an "after": (used FTP) http://footfetishgallery.net/gallery/thumbnails/04b.jpg |
just added "sleep(20);" before the "copy" command thinking the image might be copied before it has been fully uploaded or something - I got the same result.
maybe i did'nt put it in the right place |
Quote:
AFAIK, the php page doesn't even run until the entire request has completed, and file uploads are part of the request... so no sleep() would be necessary. |
Quote:
http://footfetishgallery.net/gallery/temp.html i'm really out of ideas about this |
Aha, I think I have it.
I did a 'strings' on your 04b.gif file and found the following: -----------------------------7d51181aaf4 Content-Disposition: form-data; name="imagefile"; filename="C:\backup\guitarstuff\project\tgp\xf\1\0 4.jpg" Content-Type: image/pjpeg It would appear that you're saving the entire raw response string, and not purely the image itself. It maybe the way the file gets handled in the code? Here's what I've used in the past: Code:
if(is_uploaded_file($_FILES[img][tmp_name])) { HTH. :thumbsup |
Hi,
This might be of help to you, but I am not sure. It's something I use to upload and move a file to a directory on my server and the GD library also makes a thumbnail version of the image and uploads it to the same directory, but adds a prefix the image name. I put it in a .txt for you: http://www.penis-enlargement-product.us/misc/zester.txt |
Quote:
|
Quote:
tried the code you posted here and got the same result mate |
It's a strange bug... the php code is correct, the form element looks right, and the picture is presumably getting to the right place, the problem is that it's getting messed in the upload.
Have you tried uploading it using a different browser? If it works via a new browser, then it's your old one that's breaking... if it's still buggered, then somehow your server is broken. Having that multipart header embedded in the upload stream is very odd indeed. I'm leaning towards a broken server at this point. |
Quote:
tried it with other browsers same thing any idea how the hell my host can handle this? what to tell him? |
Is your host using recent version of php and apache?
|
Quote:
|
Quote:
- Your images are being corrupted on upload. - You've checked, changed, and confirmed that the code used to process uploads is correct and verified by third parties - The image itself is being corrupted in the upload process. The uploaded image contains part of the headers from the submission, plus extra crap that doesn't belong. Show them the before and after, and point out that the uploaded image ends up LARGER than the original image. - Make sure they know you've tried uploading with different browser types, removing a broken browser as being the reason for the failure - Try uploading other images to see if it happens regardless of the source, which will remove the possibility of a broken graphic as the cause - By the process of elimination (not browser, not code, not image) the only other option would be the way the server handles it. |
All times are GMT -7. The time now is 05:30 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123