mosimage adding space to selected gallery image list?

Discuss the development and implementation of Joomla! components here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

mosimage adding space to selected gallery image list?

Post by oestek » Sun Jul 17, 2011 5:48 pm

I've been running this site for several years, and all of a sudden this problem starts.

Each time I revise a content item and hit apply, a space appears in the the selected content images list (right column in picture above). This throws off the image / mosimage tag alignment and the images do not appear in the published content item. Any idea what's causing this?

Thanks!

Image

bobmail
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jul 19, 2011 6:52 pm

Re: mosimage adding space to selected gallery image list?

Post by bobmail » Tue Jul 19, 2011 6:57 pm

same exact problem here, out of the blue. version 1.0.x.

anyone?

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Thu Jul 21, 2011 3:05 pm

Anyone?

bobmail
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jul 19, 2011 6:52 pm

Re: mosimage adding space to selected gallery image list?

Post by bobmail » Thu Jul 21, 2011 6:47 pm

after much digging i believe i know why. the problem is when a form is submitted, \n in strings is converted to \r\n, at least on windows machines. joomla uses \n as delimiters for image names but when that \r gets in there it screws everything up. so the trick is to remove the \r chars before data is saved to db. it's probably fine in newer versions of joomla, but for now this is what i did and tested it lightly. seems ok. hth

file: administrator/components/com_typedcontent/admin.typedcontent.php

code snippet: (look for the one line of code added below)
[ ... ]
function save( $option, $task ) {
global $database, $my, $mosConfig_offset;

josSpoofCheck();

$nullDate = $database->getNullDate();
$menu = strval( mosGetParam( $_POST, 'menu', 'mainmenu' ) );
$menuid = intval( mosGetParam( $_POST, 'menuid', 0 ) );

$row = new mosContent( $database );
if (!$row->bind( $_POST )) {
echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
exit();
}
// ********** ADD the line below ****************
$row->images=str_replace("\r","",$row->images);
// *******************************************

if ($row->id) {
$row->modified = date( 'Y-m-d H:i:s' );
$row->modified_by = $my->id;
}
[ ... ]

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Sat Jul 23, 2011 5:10 pm

That looks like a logical solution, but did not work in my case. Each time I referesh, the MOS content gallery list still adds another line. Thanks for the help... any other ideas?

bobmail
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Tue Jul 19, 2011 6:52 pm

Re: mosimage adding space to selected gallery image list?

Post by bobmail » Sat Jul 23, 2011 5:53 pm

sorry to hear, did the job for me. interesting that you mention "refresh". in my case it was "apply" that was causing it and the gap just kept on growing with every itereation. stupid question, but have you tried a different browser? same results?

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Sat Jul 23, 2011 6:02 pm

You're correct, "apply" is what does it. Sorry for the confusion. Same results all browsers.

Thanks...

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Tue Aug 23, 2011 2:36 pm

Anyone?

Still having this issue.

Thanks!

gab696
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Oct 01, 2007 5:33 pm

Re: mosimage adding space to selected gallery image list?

Post by gab696 » Wed Oct 19, 2011 2:44 pm

Any solution to this problem ?

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Wed Oct 19, 2011 3:43 pm

Still having the issue here, the work around is to go into php myadmin and manually delete the extra lines from the content item... it's a pain.

shem_lexluger
Joomla! Apprentice
Joomla! Apprentice
Posts: 21
Joined: Tue Mar 11, 2008 1:09 pm

Re: mosimage adding space to selected gallery image list?

Post by shem_lexluger » Tue Jan 31, 2012 5:38 pm

Try adding this line into administrator/components/com_content/admin.content.php in function saveContent() before the line if (!$row->check()) {

$row->images = str_replace("\n\r", "", $row->images);

johnmendonca
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Feb 11, 2012 10:03 am

Re: mosimage adding space to selected gallery image list?

Post by johnmendonca » Sat Feb 11, 2012 10:12 am

I added the hack above but it didn't fix for me on an existing article with "the problem". :'(
Dug some more and came up with another idea. If the image name is whitespace, don't create the html option. :geek:
Seems to work, my client will be stoked...

Small change surround by comments in file:

includes/joomla.php

Code: Select all

 function GetSavedImages( &$row, $path ) {
                $images2 = array();

                foreach( $row->images as $file ) {
                        $temp = explode( '|', $file );
                        if( strrchr($temp[0], '/') ) {
                                $filename = substr( strrchr($temp[0], '/' ), 1 );

                        //John is making this hack recklessly for mosimage adding space problem
                        } elseif( strlen(trim($temp[0])) == 0) {
                                continue;
                        //end hacking

                        } else {
                                $filename = $temp[0];
                        }
                        $images2[] = mosHTML::makeOption( $file, $filename );
                }

                $javascript     = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \"";
                $imagelist      = mosHTML::selectList( $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' );

                return $imagelist;
        }

oestek
Joomla! Apprentice
Joomla! Apprentice
Posts: 27
Joined: Tue Nov 20, 2007 4:01 pm

Re: mosimage adding space to selected gallery image list?

Post by oestek » Sat Feb 11, 2012 6:43 pm

I think that worked! Thanks!

User avatar
Adam Eterno
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 120
Joined: Fri Aug 19, 2005 11:20 pm
Location: Ireland

Re: mosimage adding space to selected gallery image list?

Post by Adam Eterno » Tue Nov 26, 2013 4:22 pm

Worked for me - many thanks for sharing. The only problem now is that MosImage is (and was before this hack, stuck on a sub-folder). anyone remember where to reset this?

I really don't miss all this faffing around that cames/comes with joomla 1.


Locked

Return to “Components”