JPEG's and PNG's are seen as corrupt by the database

ColorCode

New Member
Hello.

I'm a nooby programmer and I've been having some trouble with my database. For some reason the database I use is very very aggressive when it comes to flagging corrupted images. I haven't been able to use one single JPEG or PNG file without the database saying the the image is corrupted or invalid. This while the images open just fine in other programs like the windows image viewer and Paint Shop Pro.

I've tried downloaded images and images that I created myself with PSP. I've tried opening them and saving them as another file type in PSP, also doesn't work. The only thing that does work (just about) are GIF's. I use multiple GIF images as buttons on my site and they work fine, except since recently one image, wich is displayed but only half of it. The other half is just missing and scrambled.

It's very frustrating. I'm trying to build my own site to get some experience in webdesign so I can land a job in that profession. I've already encountered so many problems and now this.

Any help is much appreciated.
 

ishie

New Member
Have you tried re-installing the program? Maybe it's the cause of the error, not the images.
 

ColorCode

New Member
What program lol? I know it's not the images that cause the error because they work fine in every other program I open them with. Something is either wrong with the database or PHP. I downloaded WAMP. I have the same problem there. It's just that now the server says that the directory in wich the picture is placed doesn't exist. It also says this about the picture itself. It's ridiculous. I tried both JPEG's and GIF's.
 

ishie

New Member
What program lol? I know it's not the images that cause the error because they work fine in every other program I open them with. Something is either wrong with the database or PHP. I downloaded WAMP. I have the same problem there. It's just that now the server says that the directory in wich the picture is placed doesn't exist. It also says this about the picture itself. It's ridiculous. I tried both JPEG's and GIF's.
Haha! I think I misread your question. Sorry for my stupidity, lol!
 

constanthosting

New Member
What kind of dataset are you attempting to store the image as? check and see if the database is storing the image as a 'blob' ?

It's often much more efficient to store images in a directory and then store the information concerning the image and it's location in the database.
 

ColorCode

New Member
I think I may have been miscommunicating myself. I don't mean database as in MySQL database, I simply mean a server or a host. My index file, the CSS and the images are stored on a server. The images are in a directory called "Images". This directory sits in the same directory as my index and CSS files. When I type out PHP in my index file like so:

<html>
<header>

</header>
<body>

<?php
imagecreatefromjpeg(Images/Supernova.jpeg)
?>

</body>
</html>

and run the code, the image in the directory "Images/Supernova.jpeg" is not displayed on my screen. All I get is errors saying the image is corrupted. When I do the same with my WAMP server on my computer it says that neither the directory nor the image exist. I don't understand what's wrong
 

constanthosting

New Member
best and simplest way to show an image is to use html as the following

<img src="Images/Supernova.jpeg" alt="Super Nova" />


so your file there would look like


<html>
<header>

</header>
<body>

<img src="Images/Supernova.jpeg" alt="Super Nova" />

</body>
</html>
 

ColorCode

New Member
I know, I tried that to. Doesn't work. Errors, errors, errors.

I read this:

"As of PHP 5.1.3, if you are dealing with corrupted JPEG images you should set the 'gd.jpeg_ignore_warning' directive to 1 to ignore warnings that could mess up your code.

In runtime, you should do this:

<?php

ini_set('gd.jpeg_ignore_warning', 1);

?>

Regards,
Paulo Ricardo"

on this site:

http://www.webdesignforum.com/newreply.php?do=newreply&noquote=1&p=37690


Tried that to, didn't work. Allthough I got fewer errors, but my image still didn't display. This is really bugging me out. By the way, from what I saw this forum is huge. Why are you two the only one's who've replied? Thnx for your thoughts though.
 
Top