Using Media Popup to select image

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Using Media Popup to select image

Postby babberoo » Wed Apr 02, 2008 7:55 am

I've created a Property Sales component, and wish to using the Media Manager popup to allow the user to select a thumbnail and full image of the required property. I've copied the code from the Editor to open the popup, but when I select the image, it populates the Editor window rather than the input form that I have supplied.

Code: Select all

<tr>
                     <td>
                        <label for="thumbnailImage"><?php echo JText::_( 'Thumbnail Image' ) ?></label>
                     </td>
                     <td>
                        <input id="thumbnailImage" name="thumbnailImage" value="<?php echo $row->thumbnailImage; ?>" />
                        <a class="modal-button" rel="{handler: 'iframe', size: {x: 570, y: 400}}" href="index.php?option=com_media&view=images&tmpl=component&e_name=thumbnailImage" title="Image">Image</a>
                     </td>
                  </tr>


How can I use this to populate the URL into my input box, without hacking the javascript for the popup? Is there a better way to do this?

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Re: Using Media Popup to select image

Postby babberoo » Fri Apr 04, 2008 7:56 am

Can anyone help on this or suggest a suitable plugin?

Bodom78
Joomla! Intern
Joomla! Intern
Posts: 95
Joined: Fri Nov 04, 2005 9:23 am

Re: Using Media Popup to select image

Postby Bodom78 » Thu Apr 10, 2008 10:31 am

http://www.phpletter.com/

The Ajax File / Image manager is good and can be tied into your components with a little reading through their forums. Tie it into the Editor or launch it to populate a form field with the path to the file and save that.

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Re: Using Media Popup to select image

Postby babberoo » Thu Apr 10, 2008 1:19 pm

Super. Thanks for that I'll take a look.

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Re: Using Media Popup to select image

Postby babberoo » Mon Apr 14, 2008 12:09 pm

Would I need to install the component again or is there a way to hook in to the existing functionality deployed with FCK/TinyMCE? These seem coded to use the Editors rather than populate a specific form field. Can you give me any pointers on where to look?

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Re: Using Media Popup to select image

Postby babberoo » Tue Apr 15, 2008 8:11 am

I found a solution to this at

http://groups.google.com/group/joomla-d ... dca7eec259

Essentially you pass through a parameter (say noeditor=1) and then perform the relevant action and return the URL to the field. Nice.

babberoo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 139
Joined: Wed Jan 23, 2008 5:35 pm

Re: Using Media Popup to select image

Postby babberoo » Tue May 06, 2008 12:04 pm

Update:

Using this solution works fine in Firefox, but there seems to be an Internet Explorer problem whereby you get an Unspecified Error when opening the popup window and then a 'can't execute code from a freed script joomla' error when choosing an image. This appears to be an IE only issue. Does anyone have an idea of how I might fix this?


Return to “Joombie Coding Q/A”

Who is online

Users browsing this forum: No registered users and 1 guest