473,322 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

GD Strange error

pmz
Dear Group,

I'm not sure what is going one with my software, but something really
strange.
I'm storing in BLOB in MySQL data of an image, which I display like:

header("Content-Type: image/png");
echo base64_decode($blobColumnData);

Firefox/IE says, that the image cannot be displayed because it
contains errors. I've tried setting header to image/jpeg, etc, with no
results.
At the end, I've just tried fwrite() the 'base64_decode($blobData)'
into a file and display it in Gimp - with no problems, with no
difference jpeg or png.

What's wrong? Where shall I look for problems?

Some system details:
PHP Details:
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 27 2007
01:29:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

GD Details:
gd-2.0.33_4,1
php5-gd-5.2.0
png-1.2.14
jpeg-6b_4

OS Details:
FreeBSD drum.phpdev 6.2-RELEASE FreeBSD 6.2-RELEASE

Thank you for help!

All the best,
Przemek M. Zawada

Aug 6 '07 #1
4 3377
pmz wrote:
Dear Group,

I'm not sure what is going one with my software, but something really
strange.
I'm storing in BLOB in MySQL data of an image, which I display like:

header("Content-Type: image/png");
echo base64_decode($blobColumnData);

Firefox/IE says, that the image cannot be displayed because it
contains errors. I've tried setting header to image/jpeg, etc, with no
results.
At the end, I've just tried fwrite() the 'base64_decode($blobData)'
into a file and display it in Gimp - with no problems, with no
difference jpeg or png.

What's wrong? Where shall I look for problems?

Some system details:
PHP Details:
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 27 2007
01:29:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

GD Details:
gd-2.0.33_4,1
php5-gd-5.2.0
png-1.2.14
jpeg-6b_4

OS Details:
FreeBSD drum.phpdev 6.2-RELEASE FreeBSD 6.2-RELEASE

Thank you for help!

All the best,
Przemek M. Zawada
Why are you calling base64_decode()? Did you base64_encode() the image
before storing it in the database? If so, why?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 6 '07 #2
pmz
On 6 Sie, 13:35, Jerry Stuckle <jstuck...@attglobal.netwrote:
pmz wrote:
Dear Group,
I'm not sure what is going one with my software, but something really
strange.
I'm storing in BLOB in MySQL data of an image, which I display like:
header("Content-Type: image/png");
echo base64_decode($blobColumnData);
Firefox/IE says, that the image cannot be displayed because it
contains errors. I've tried setting header to image/jpeg, etc, with no
results.
At the end, I've just tried fwrite() the 'base64_decode($blobData)'
into a file and display it in Gimp - with no problems, with no
difference jpeg or png.
What's wrong? Where shall I look for problems?
Some system details:
PHP Details:
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 27 2007
01:29:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
GD Details:
gd-2.0.33_4,1
php5-gd-5.2.0
png-1.2.14
jpeg-6b_4
OS Details:
FreeBSD drum.phpdev 6.2-RELEASE FreeBSD 6.2-RELEASE
Thank you for help!
All the best,
Przemek M. Zawada

Why are you calling base64_decode()? Did you base64_encode() the image
before storing it in the database? If so, why?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Dear Jerry,

I did call the base64_encode before storing the image in the database,
because as I mentioned before, when I 'save' the image with fwrite(),
the image opened with Gimp is perfectly working.

Sample:

$Data = base64_decode(image_from_db_encoded);

fwrite($fh, $Data);

And this works fine:
# gimp myimage.jpg &

If I do so:

header("Content-Type: image/jpeg");
print $Data;

It does not work.

For example, I've tested with sample image creation with gd, such as:
$I = imagecreate(256, 256);
$Bg = imagecolorallocate($I, 255, 0, 0);
imagejpeg($I);

It also does not work, why?
The GD is installed, even updated, phpinfo() sayz that everything is
okay, what is happening?

All the best,
Przemek

Aug 6 '07 #3
pmz
On 6 Sie, 13:43, pmz <przemek.zaw...@gmail.comwrote:
On 6 Sie, 13:35, Jerry Stuckle <jstuck...@attglobal.netwrote:
pmz wrote:
Dear Group,
I'm not sure what is going one with my software, but something really
strange.
I'm storing in BLOB in MySQL data of an image, which I display like:
header("Content-Type: image/png");
echo base64_decode($blobColumnData);
Firefox/IE says, that the image cannot be displayed because it
contains errors. I've tried setting header to image/jpeg, etc, with no
results.
At the end, I've just tried fwrite() the 'base64_decode($blobData)'
into a file and display it in Gimp - with no problems, with no
difference jpeg or png.
What's wrong? Where shall I look for problems?
Some system details:
PHP Details:
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 27 2007
01:29:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
GD Details:
gd-2.0.33_4,1
php5-gd-5.2.0
png-1.2.14
jpeg-6b_4
OS Details:
FreeBSD drum.phpdev 6.2-RELEASE FreeBSD 6.2-RELEASE
Thank you for help!
All the best,
Przemek M. Zawada
Why are you calling base64_decode()? Did you base64_encode() the image
before storing it in the database? If so, why?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

Dear Jerry,

I did call the base64_encode before storing the image in the database,
because as I mentioned before, when I 'save' the image with fwrite(),
the image opened with Gimp is perfectly working.

Sample:

$Data = base64_decode(image_from_db_encoded);

fwrite($fh, $Data);

And this works fine:
# gimp myimage.jpg &

If I do so:

header("Content-Type: image/jpeg");
print $Data;

It does not work.

For example, I've tested with sample image creation with gd, such as:
$I = imagecreate(256, 256);
$Bg = imagecolorallocate($I, 255, 0, 0);
imagejpeg($I);

It also does not work, why?
The GD is installed, even updated, phpinfo() sayz that everything is
okay, what is happening?

All the best,
Przemek

PS. I've taken the example from php.net (maybe I'm a bit tired after
working 48h) but it also gave me nothing! Just: "The image "..."
cannot be displayed, because it contains errors. Everything which is
directly connected with it (such as png/jpg libs) I've updated,
because I thought that something got damaged.

Aug 6 '07 #4
pmz wrote:
On 6 Sie, 13:35, Jerry Stuckle <jstuck...@attglobal.netwrote:
>pmz wrote:
>>Dear Group,
I'm not sure what is going one with my software, but something really
strange.
I'm storing in BLOB in MySQL data of an image, which I display like:
header("Content-Type: image/png");
echo base64_decode($blobColumnData);
Firefox/IE says, that the image cannot be displayed because it
contains errors. I've tried setting header to image/jpeg, etc, with no
results.
At the end, I've just tried fwrite() the 'base64_decode($blobData)'
into a file and display it in Gimp - with no problems, with no
difference jpeg or png.
What's wrong? Where shall I look for problems?
Some system details:
PHP Details:
PHP 5.2.3 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 27 2007
01:29:42)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
GD Details:
gd-2.0.33_4,1
php5-gd-5.2.0
png-1.2.14
jpeg-6b_4
OS Details:
FreeBSD drum.phpdev 6.2-RELEASE FreeBSD 6.2-RELEASE
Thank you for help!
All the best,
Przemek M. Zawada
Why are you calling base64_decode()? Did you base64_encode() the image
before storing it in the database? If so, why?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================


Dear Jerry,

I did call the base64_encode before storing the image in the database,
because as I mentioned before, when I 'save' the image with fwrite(),
the image opened with Gimp is perfectly working.

Sample:

$Data = base64_decode(image_from_db_encoded);

fwrite($fh, $Data);

And this works fine:
# gimp myimage.jpg &

If I do so:

header("Content-Type: image/jpeg");
print $Data;

It does not work.

For example, I've tested with sample image creation with gd, such as:
$I = imagecreate(256, 256);
$Bg = imagecolorallocate($I, 255, 0, 0);
imagejpeg($I);

It also does not work, why?
The GD is installed, even updated, phpinfo() sayz that everything is
okay, what is happening?

All the best,
Przemek
Well, first of all, there's no need to base64_encode/decode the data; it
works fine in a blog column without the extra overhead.

Do you have error reporting enabled and are you displaying errors? If
not, please do so. If so, are you seeing any errors?

Also, what's your actual failing code? Excerpts and pseudo-code don't
often solve problems.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olaf | last post by:
I have a frameset page witch contains the myFuc() function. The function is accessed from a page in one of the frames in the frameset. An example is shown below. <input...
25
by: Neil Ginsberg | last post by:
I have a strange situation with my Access 2000 database. I have code in the database which has worked fine for years, and now all of a sudden doesn't work fine on one or two of my client's...
0
by: Kris Vanherck | last post by:
yesterday i started getting this strange error when i try to run my asp.net project: Compiler Error Message: CS0006: Metadata file 'c:\winnt\microsoft.net\framework\v1.1.4322\temporary asp.net...
6
by: Gary | last post by:
I have an application that has been working just fine for a couple of years. It queries a SQL database and returns some formatted data back to the client. I have a new client, who has a larger...
5
by: Nathan Sokalski | last post by:
When I view my index.aspx page any time after the first time, I recieve the following error: System.Web.TraceContext.AddNewControl(String id, String parentId, String type, Int32 viewStateSize)...
0
by: ivb | last post by:
Hi all, I am using DB2 8.1.11.1 on NT with ASP.NET 1.1 When application make connection to database (via ADO.NET), it set "Connection timeout" parameter to 30 seconds. After, when my webpage...
11
by: Martin Joergensen | last post by:
Hi, I've encountered a really, *really*, REALLY strange error :-) I have a for-loop and after 8 runs I get strange results...... I mean: A really strange result.... I'm calculating...
1
by: JoReiners | last post by:
Hello, I have a really strange problem. I'm unable to figure it out on my own. I parse very simple xml documents, without any check for their form. These files look very similar and are encoded...
11
by: Mike C# | last post by:
Hi all, I keep getting a strange error and can't pin it down. The message is: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's...
3
by: Shelly | last post by:
I am encountering two strange problems. First one: I get a "server misconfiguration error", but only sometimes. It occurs on the first screen that accesses the database on a submit. This error...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.