mosimage adding space to selected gallery image list?
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.
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.
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
mosimage adding space to selected gallery image list?
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!
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!
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Jul 19, 2011 6:52 pm
Re: mosimage adding space to selected gallery image list?
same exact problem here, out of the blue. version 1.0.x.
anyone?
anyone?
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Jul 19, 2011 6:52 pm
Re: mosimage adding space to selected gallery image list?
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;
}
[ ... ]
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;
}
[ ... ]
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
Re: mosimage adding space to selected gallery image list?
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?
-
- Joomla! Fledgling
- Posts: 3
- Joined: Tue Jul 19, 2011 6:52 pm
Re: mosimage adding space to selected gallery image list?
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?
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
Re: mosimage adding space to selected gallery image list?
You're correct, "apply" is what does it. Sorry for the confusion. Same results all browsers.
Thanks...
Thanks...
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
Re: mosimage adding space to selected gallery image list?
Anyone?
Still having this issue.
Thanks!
Still having this issue.
Thanks!
-
- Joomla! Apprentice
- Posts: 6
- Joined: Mon Oct 01, 2007 5:33 pm
Re: mosimage adding space to selected gallery image list?
Any solution to this problem ?
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
Re: mosimage adding space to selected gallery image list?
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.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Tue Mar 11, 2008 1:09 pm
Re: mosimage adding space to selected gallery image list?
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);
$row->images = str_replace("\n\r", "", $row->images);
-
- Joomla! Fledgling
- Posts: 1
- Joined: Sat Feb 11, 2012 10:03 am
Re: mosimage adding space to selected gallery image list?
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.
Seems to work, my client will be stoked...
Small change surround by comments in file:
includes/joomla.php
Dug some more and came up with another idea. If the image name is whitespace, don't create the html option.
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;
}
-
- Joomla! Apprentice
- Posts: 27
- Joined: Tue Nov 20, 2007 4:01 pm
Re: mosimage adding space to selected gallery image list?
I think that worked! Thanks!
- Adam Eterno
- Joomla! Enthusiast
- Posts: 120
- Joined: Fri Aug 19, 2005 11:20 pm
- Location: Ireland
Re: mosimage adding space to selected gallery image list?
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.
I really don't miss all this faffing around that cames/comes with joomla 1.