Forums / Developer / Database transaction failed when creating a new image object

Database transaction failed when creating a new image object

Author Message

Nicolay Camargo

Wednesday 04 January 2006 6:27:16 pm

When I try to publish some image object, the common error message appears:

<i>Fatal error: A database transaction in eZ publish failed.</i>.

It's a strange behavior because this kind of objects is often published successfully. Reviewing the postgreSQL database error log I found this related message:

<i>ERROR: invalid byte sequence for encoding "UNICODE": 0xd00d</i>

The full message is shown at the bottom. I wanted to find out more and I noted that in this case the problem is related with the EXIF data within each JPEG format image. When I edit the image with an advanced editor and choose "Don't save EXIF data" option, image is accepted in ezpublish without any error.

I'm not quite sure but it seems like a hidden character in this EXIF data created by the digital camera natively. I think that this character is incompatible with the UNICODE encoding in the database. am I right? must I report this as a bug? Although I have a way to solve this problem, it is difficult to any of my site users to publish an image like that, because they probably don't have an advanced image editor and anyway the work become tedious. So, can you help me to solve this problem? I'll thank you a lot.

This is the full message:

<i>ERROR: invalid byte sequence for encoding "UNICODE": 0xd00d
LOCATION: pg_verifymbstr, wchar.c:862
SENTENCE: UPDATE ezcontentobject_attribute
SET contentclassattribute_id='118', attribute_original_id='0',
sort_key_int='0', sort_key_string='', data_type_string='ezimage',
data_text='<?xml version="1.0" encoding="UTF-8"?>
<ezimage serial_number="1"
is_valid="1"
filename="ensenando1.jpg"
suffix="jpg"
basename="ensenando1"
dirpath="var/castillo/storage/images-versioned/391/1-esl-ES"
url="var/castillo/storage/images-versioned/391/1-esl-ES/ensenando1.jpg"
original_filename="ensenando.jpg"
mime_type="image/jpeg"
width="640"
height="480"
alternative_text=""
alias_key="1293033771"
timestamp="1136396644">
<original attribute_id=""
attribute_version=""
attribute_language="" />
<information Height="480"
Width="640"
IsColor="1"
ByteOrderMotorola="0"
ApertureFNumber="f/2.8"
UserComment=""
Thumbnail.FileType="2"
Thumbnail.MimeType="image/jpeg">
<array name="ifd0">
<item key="ImageDescription">OLYMPUS DIGITAL CAMERA </item>
<item key="Make">OLYMPUS OPTICAL CO.,LTD</item>
<item key="Model">C150,D390</item>
<item key="Orientation">1</item>
<item key="XResolution">144/1</item>
<item key="YResolution">144/1</item>
<item key="ResolutionUnit">2</item>
<item key="Software">41-1002A</item>
<item key="DateTime">2003:11:30 10:03:10</item>
<item key="YCbCrPositioning">2</item>
<item key="Exif_IFD_Pointer">158</item>
<item key="UndefinedTag:0xC4A5">PrintIM0250
&#65533;&#65533; &apos;&apos;&apos;&apos;&apos;^&apos;&apos;&#65533;apos;&#65533;apos;</item>
</array>
<array name="exif">
<item key="ExposureTime">216/10000</item>
<item key="FNumber">28/10</item>
<item key="ExposureProgram">2</item>
<item key="ISOSpeedRatings">100</item>
<item key="ExifVersion">0220</item>
<item key="DateTimeOriginal">2003:11:30 10:03:10</item>
<item key="DateTimeDigitized">2003:11:30 10:03:10</item>
<item key="ComponentsConfiguration"></item>
<item key="CompressedBitsPerPixel">23/10</item>
<item key="ExposureBiasValue">0/10</item>
<item key="MaxApertureValue">300/100</item>
<item key="MeteringMode">2</item>
<item key="LightSource">0</item>
<item key="Flash">24</item>
<item key="FocalLength">500/100</item>
<item key="MakerNote">OLYMPv&#130;&#65533; &#65533;#
)8:</item>
<item key="UserComment"> </item>
<item key="FlashPixVersion">0100</item>
<item key="ColorSpace">1</item>
<item key="ExifImageWidth">1600</item>
<item key="ExifImageLength">1200</item>
<item key="InteroperabilityOffset">1096</item>
<item key="FileSource"></item>
<item key="CustomRendered">0</item>
<item key="ExposureMode">1</item>
<item key="WhiteBalance">0</item>
<item key="DigitalZoomRatio">160/100</item>
<item key="SceneCaptureType">0</item>
<item key="GainControl">1</item>
<item key="Contrast">0</item>
<item key="Saturation">0</item>
<item key="Sharpness">0</item>
</array>
</information>
</ezimage>', data_int=NULL, data_float='0.000000'
WHERE id='391' AND contentobject_id='119' AND version='1' AND language_code='esl-ES'</i>

Thanks,

Nicolay
Corenet S.A.
Bogota - Colombia
www.corenet.net.co
acamargo@corenet.net.co