We help IT Professionals succeed at work.

Joomla Category Image Selection - Defaut Blank Image Not Displaying

meraTechStuff
on
Hello,

I'm using latest version of Joomla 1.5.18 with default Admin template. When I tried to create a Category, under the category image selection option, the default blank image is not displayed. instead it displays the alternative text which is "Preview".

The exact file is: /administrator/components/com_categories/admin.categories.html.php
The exact bit of code is provided in the attachment. You can look the code at the line 370

There is a problem in this line: document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');

The image path is wrong! I fixed it several months ago by referring the web. But unfortunately the file is overridden by Joomla update. I don't have any backup.

I would appreciate if anyone let me know with the fix! Thanks.
<tr>
						<td>&nbsp;</td>
						<td>
						<script language="javascript" type="text/javascript">
						if (document.forms.adminForm.image.options.value!=''){
							jsimg='../<?php echo $cparams->get('image_path'); ?>/' + getSelectedValue( 'adminForm', 'image' );
						} else {
							jsimg='../images/M_images/blank.png';
						}
						document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');
						</script>
						</td>
					</tr>

Open in new window

Comment
Watch Question

Shinesh PremrajanEngineering Manager
Commented:
try this code, you missed a double quote
document.write('<img src="' + jsimg + '" name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');

Open in new window

Author

Commented:
Not worked! Still it displays the alternative text "Preview". The image address for that blank image is: https://domain.com/images/stories/

The path to the image is not correct. If the user didn't selected any image for the category, it should display the default blank image (images/M_images/blank.png)

i.e., The path to the image should refer to: http://domain.com/images/M_images/blank.png

I think specifying the direct path to the image will solve the problem instead of using local path, any idea?
Shinesh PremrajanEngineering Manager

Commented:
I am expecting that the images are in the base directory, so try removing the double dots from the image path.
like:
jsimg='/images/M_images/blank.png';

Hope this helps

Author

Commented:
Hi,

The image path is already set to use single quotes: jsimg='../images/M_images/blank.png';
Shinesh PremrajanEngineering Manager

Commented:
jsimg='../images/M_images/blank.png'; //Change

to

jsimg='/images/M_images/blank.png';  // to this

Author

Commented:
This is also not worked! It still showing the alternative text instead if the image!
Finally I fixed it by myself again. In the following line I replaced the code with this:
Old Code:

document.write('<img src=' + jsimg + ' name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');

New Code:

document.write('<img src="../images/M_images/blank.png" name="imagelib" width="80" height="80" border="2" alt="<?php echo JText::_( 'Preview', true ); ?>" />');

Open in new window