main top header image show network and world montage
clear spacer image
Main Menu
Home
News
About Us
Tutorials
Forums
Contact Us
Newsletter
Search
Recommend Us
Tools Menu
Order Web Hosting
Register Domain Name
Transfer Domain Name
Who Owns Domain?
Domain Suggestions
Manage Domain Name
Search Engine Submit
Free Files
Submit Trouble Ticket
 


clear spacer image Home
ewiget
Admin

Admin
Posts: 171
graph
Karma: 2  
extending mambo / joomla media manager - 2006/12/20 14:32 One of the nice features about mambo and joomla is the media manager which allows you to upload images, documents, etc for use in articles. One of the downsides though is that it only supports a few file extensions, such as: gif, jpg, png, bmp, doc, xls, ppt, swf, pdf

Don't you wish there was an easy way to add documents such as rar, zip, ipk, tar.gz, exe, etc?

This howto shows you how to do just that.

First, make a backup of your web site. If you don't want to make a full backup, at least backup the files we are working with, specifically the file /public_html/administrator/components/com_media/admin.media.php

Next, open that file in a text editor. If you are using windows, you should use an editor that will not break the unix linebreaks...meaning, don't use notepad, wordpad, word, etc. Download a free editor, crimson editor, and use it to edit this file.

Find the section in the file that has:
Code:

 if ((strcasecmp(substr($file['name'],-4),".gif")) && (strcasecmp(substr($file['name'],-4),".jpg")) && (strcasecmp(substr($file['name'],-4),".png")) && (strcasecmp(substr($file['name'],-4),".bmp")) &&(strcasecmp(substr($file['name'],-4),".doc")) && (strcasecmp(substr($file['name'],-4),".xls")) && (strcasecmp(substr($file['name'],-4),".ppt")) && (strcasecmp(substr($file['name'],-4),".swf")) && (strcasecmp(substr($file['name'],-4),".pdf"))) {             mosRedirect"index2.php?option=com_media&listdir=".$_POST['dirPath'], "Only files of type gif, png, jpg, bmp, pdf, swf, doc, xls, or ppt can be uploaded" );



and replace it with this code, which adds txt, zip, tar.gz, gz, ipk, exe to the list

Code:

 if ((strcasecmp(substr($file['name'],-4),".gif")) && (strcasecmp(substr($file['name'],-4),".jpg")) && (strcasecmp(substr($file['name'],-4),".png")) && (strcasecmp(substr($file['name'],-4),".bmp")) &&(strcasecmp(substr($file['name'],-4),".doc")) && (strcasecmp(substr($file['name'],-4),".xls")) && (strcasecmp(substr($file['name'],-4),".ppt")) && (strcasecmp(substr($file['name'],-4),".swf")) && (strcasecmp(substr($file['name'],-4),".txt")) && (strcasecmp(substr($file['name'],-4),".zip")) && (strcasecmp(substr($file['name'],-3),".gz")) && (strcasecmp(substr($file['name'],-4),".rar")) && (strcasecmp(substr($file['name'],-4),".ipk")) && (strcasecmp(substr($file['name'],-4),".exe")) && (strcasecmp(substr($file['name'],-3),".sh")) && (strcasecmp(substr($file['name'],-4),".pdf"))) {             mosRedirect"index2.php?option=com_media&listdir=".$_POST['dirPath'], "Only files of type gif, png, jpg, bmp, pdf, swf, txt, zip, doc, xls, gz, rar, sh, ipk, exe, or ppt  can be uploaded" );



Now, you can upload those documents, however, the icons will not be correct.....so download the images attachment that is included in this forum post. Extract the images to your local hard drive, and then upload them to /public_html/administrator/components/com_media/images directory.

That should be all you need to do. You can add other extensions by simply using this code:
Code:

  && (strcasecmp(substr($file['name'],-3),".sh"))



to the list above and replace .sh with the extension you want to use. Also, you will need to modify the -3 to the number for your extension. Basically, count the numbers or letters that comprise the extension, plus the "." and that is the number you use. For example, for .sh there are 3 characters, so this extension has a -3. For an extension of .doc there are 4 characters counting the "." so it would be -4.

One extension not in the list is .java so if you wanted to add that extension you would use this code:
Code:

  && (strcasecmp(substr($file['name'],-5),".java"))



Notice the extension is .java and there are 5 characters counting the "."
File Attachment:
File name: images.zip
File size:13448 bytes


Post edited by: ewiget, at: 2006/12/20 14:34
Ed Wiget
Technical Support
http://www.xtremewebhosts.com
  | | The administrator has disabled public write access.
ewiget
Admin

Admin
Posts: 171
graph
Karma: 2  
Re:extending mambo / joomla media manager - 2006/12/27 13:16 someone said that this doesn't allow flv (flash video) to be uploaded through media manager and that would be a nice addition. I agree, so here is the code to add to the above file:

Find in the admin.media.php file this line:
Code:

  if ((strcasecmp(substr($file['name'],-4),".gif")) && (strcasecmp(substr($file['name'],-4),".jpg")) && (strcasecmp(substr($file['name'],-4),".png")) && (strcasecmp(substr($file['name'],-4),".bmp")) &&(strcasecmp(substr($file['name'],-4),".doc")) && (strcasecmp(substr($file['name'],-4),".xls")) && (strcasecmp(substr($file['name'],-4),".ppt")) && (strcasecmp(substr($file['name'],-4),".swf")) && (strcasecmp(substr($file['name'],-4),".txt")) && (strcasecmp(substr($file['name'],-4),".zip")) && (strcasecmp(substr($file['name'],-3),".gz")) && (strcasecmp(substr($file['name'],-4),".rar")) && (strcasecmp(substr($file['name'],-4),".ipk")) && (strcasecmp(substr($file['name'],-4),".exe"))  && (strcasecmp(substr($file['name'],-3),".sh")) && (strcasecmp(substr($file['name'],-4),".pdf"))) {             mosRedirect"index2.php?option=com_media&listdir=".$_POST['dirPath'], "Only files of type gif, png, jpg, bmp, pdf, swf, txt, zip, doc, xls, gz, rar, sh, ipk, exe, or ppt  can be uploaded" );         }



and replace it with this code:
Code:

  if ((strcasecmp(substr($file['name'],-4),".gif")) && (strcasecmp(substr($file['name'],-4),".jpg")) && (strcasecmp(substr($file['name'],-4),".png")) && (strcasecmp(substr($file['name'],-4),".bmp")) &&(strcasecmp(substr($file['name'],-4),".doc")) && (strcasecmp(substr($file['name'],-4),".xls")) && (strcasecmp(substr($file['name'],-4),".ppt")) && (strcasecmp(substr($file['name'],-4),".swf")) && (strcasecmp(substr($file['name'],-4),".txt")) && (strcasecmp(substr($file['name'],-4),".zip")) && (strcasecmp(substr($file['name'],-3),".gz")) && (strcasecmp(substr($file['name'],-4),".rar")) && (strcasecmp(substr($file['name'],-4),".ipk")) && (strcasecmp(substr($file['name'],-4),".exe"))  && (strcasecmp(substr($file['name'],-4),".flv")) && (strcasecmp(substr($file['name'],-3),".sh")) && (strcasecmp(substr($file['name'],-4),".pdf"))) {             mosRedirect"index2.php?option=com_media&listdir=".$_POST['dirPath'], "Only files of type gif, png, jpg, bmp, pdf, swf, txt, zip, doc, xls, gz, rar, sh, ipk, exe, flv,  or ppt can be uploaded" );         }



and here is the updated file if you don't want to edit it. This must be extracted using winzip or similar and uploaded to your joomla / mambo folder /path_to_mambo_or_joomla/administrator/components/com_media and replace the existing file with this one attached:
File Attachment:
File name: admin.zip
File size:3191 bytes
Ed Wiget
Technical Support
http://www.xtremewebhosts.com
  | | The administrator has disabled public write access.
ewiget
Admin

Admin
Posts: 171
graph
Karma: 2  
Re:extending mambo / joomla media manager - 2006/12/27 13:33 You might also want to see our FAQ about how to insert video into a web page, it covers converting videos to flv files:

FAQ - add video to web page

You might also want to check out the JoomlaWorks All Videos plugin for mambo/joomla available here - AllVideos Plugin This is pretty simple to use.

No HTML for you or your clients! Just place a tag inside your content like {youtube}374536{/youtube}, {flv} company_presentation{/flv} or {mp3}bobsinclar-worldholdon{/mp3} (when using videos or audio files from your server) and you're done, with no HTML hassle at all! Embed videos from YouTube, Google Video and over 40 other video providers in your Joomla!

Post edited by: ewiget, at: 2006/12/27 13:50
Ed Wiget
Technical Support
http://www.xtremewebhosts.com
  | | The administrator has disabled public write access.
Professional Web Site Design & Hosting Service - References Available by Request

© 2009 Xtreme Web Hosts - Professional web site hosting, business website hosting and domain names
Joomla! is Free Software released under the GNU/GPL License.
Today is:   Tuesday, 06 January 2009 03:39