Empty spaces inside photo's description textfield. Empty spaces inside photo's description textfield.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Empty spaces inside photo's description textfield.

Started by flapane, January 01, 2015, 04:39:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

flapane

I noticed that if I upload some photo and then add a description, the description text field contains 31 empty spaces which must be manually deleted.
I couldn't find any setting where to set the default text of the photo's description, nor Firebug or theme.php seem to help.
Any hints?
Thank you and happy new year
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

I cannot replicate that issue in my testbed. Maybe the description has automatically be imported by IPTC data?

flapane

#2
Ugh, that's interesting: it looks like that Photoshop CS5 is somehow adding those spaces in the description field. It doesn't happen if I resize the photo with another software.
It didn't happen with my previous Nikon D80 camera nor it happens with a Samsung S4 Mini.
It seems that the issue occurs when editing JPG files produced by a relatively recent Sony A6000 camera.
What's even stranger is that Windows 7 x64 doesn't show such empty spaces in "file properties --> desciprition".

It doesn't happen if I upload an untouched 24Mpix A6000 JPG file, so it's definitely Photoshop CS5's fault.

I may disable IPTC data import feature, given that I don't insert location/title/keywords in the JPG file.
Otherwise, if you want I can attach an A6000 jpg file, and if it turns out that it happens with more recent versions of Photoshop, an exception for A6000 desciprion field could be added to cpg source code.
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

Open include/picmgmt.inc.php, find
                $title = (isset($iptc['Headline'])) ? $iptc['Headline'] : $title;
                $caption = (isset($iptc['Caption'])) ? $iptc['Caption'] : $caption;

and replace with
                $title = (isset($iptc['Headline'])) ? trim($iptc['Headline']) : $title;
                $caption = (isset($iptc['Caption'])) ? trim($iptc['Caption']) : $caption;


This should fix the issue for future uploads. It's maybe a good improvement for the core code, so please confirm if it works as expected.

flapane

trim() does the trick, so I can confirm that it fixes the issue.

As usual, thanks for your help!
Flapane
www.flapane.com

Gallery
www.gallery.flapane.com

Αndré

Committed in SVN revision 8757. Will be part of cpg1.5.36 and later.