|
|
Want to know more about Packt's Article Network? Interested in contributing your article ideas? Please visit our FAQ for more information. See More BROWSE
All Titles WordPress Web Services SOA BPEL Web Graphics & Video Web Development RAW Portugues, Espanol, Italiano, French PHP/MySQL Oracle Open Source Networking & Telephony Moodle Microsoft & .NET Linux Servers jQuery Joomla! JBoss Java e-Learning e-Commerce Dynamics Drupal CRM Cookbook Content Management Beginner Guides Architecture and Analysis AJAX Future Titles Recently Published Titles This three part article series by Alfonso V. Romero, teaches you how to create and edit your first template in Roller, along with some basics about the Velocity template language, and how to create your first Roller theme from scratch. You'll also learn about Roller's model and data objects, and how to use these objects' properties, methods, and macros in a custom template to show data from your weblog. Basically, in this article series you shall:
See More |
Spicing Up Your Blog: Uploading Files and Images to your Weblog using Apache Roller
This article gives you insight on weblogs and how they can be used to create a worldwide presence through the blogosphere. It also teaches you the difference between a blog and a CMS, the basics about newsfeeds and the important role they play for blogs, and how you can use them to spread information on the blogosphere. Before the action beginsBefore starting with this article's exercises, you need to download the support files (screenshots, videos, sounds, and so on) from http://www.packtpub.com/files/code/9508_Code.zip, and then unzip them into a folder—C:ApacheRollerBook, for example—on your hard drive. All these files are zipped in a file named chapter05.zip. Inside this file, there's an image file (chapter05_01.jpg), a sound file (seaontherocks.mp3), and several files for the video example (showvbox.mp4, showvbox_controller.swf, and FirstFrame.png). Uploading files to your weblogNow that you have the basic knowledge about how to manage your weblog, it's time to make things more interesting for you and your future visitors. So, how can we do that? Well, multimedia files (audio or video) are always a good addition to a web page, because they can express much more than using text-only posts. Imagine what you could offer to your clients, if you had an online specialty store. You could show your new items in your Roller weblog with full color photos, and you could also embed videos of your items in your posts, to give visitors a complete virtual tour of your store! To top that, you could show them a custom Google Map, where they could get directions from their location to your store! What else could you ask for? Using images on your postsAn image can say a thousand words and if you include some of them in your posts, imagine the space you can save. Roller has a very friendly interface to help you upload and include images in your posts, and now you're about to learn how to do it! Time for action – uploading images into RollerIn this exercise, I'll show you how to use Roller's file upload interface, so that you can add an image to an entry (post) in your blog:
Apache Roller 4.0 – Beginner's Guide
What just happened?Now you know how to upload images to your Roller weblog and guess what? You can use the same File Upload page to upload videos and sound files, too! You can also upload Word, Excel, PowerPoint, and almost every other file type you can imagine. The only restriction is file size—1 MB or less for each file you want to upload. However, what if you want to increase the size limit for uploading files? Well, we'll see how to deal with that problem in the following subsection. You also learned how to use the Insert/Modify Image and Maximize/Minimize Editor buttons from the Rich Text editor. With these two buttons you can insert images and, if they are too big to see in the editor, you can maximize the editor to cover all your workspace area, so that you can manipulate images more easily. The Insert/Modify Image button lets you insert an image on an entry. In the Image URL field, you can type the URL of an uploaded image, or you can type the URL of an image located anywhere on the Internet. Changing file upload size limitPreviously, you learned how to upload an image to Roller and include it in a post. The File Upload page lets you upload up to four files, and each one of them must be smaller than 1 MB. What happens if you want to insert a video in one of your posts, and its size is greater than 1 MB? Well, there are two things you need to modify—Roller's File Upload Settings and a property called struts.multipart.maxSize in the struts.properties file of your Roller installation. File upload settingsThe first thing you need to do is change the size limit for file uploads in the File Upload Settings section from Roller's Global Server settings. The default size limit is 1 MB, to protect your weblog server in case an intruder tried to upload a very big file that could make the server crash or run out of storage space. If you plan to have other users in your weblog server, be careful with this setting because maybe someone could upload too many videos for your weblog server to handle! Time for action – changing Roller's file upload settingsIn the following exercise, I'll show you how to change the size limit for file uploads.
What just happened?The previous exercise taught you how to change the size limit for file uploads, among other things. The following table lists all the options available in the File Upload Settings section of the Roller Configuration page:
You can change the file and directory size limits to suit your own needs. Just be sure to allow enough space for all the files you want to upload. The struts.properties fileAs Roller is based on the Struts Web Framework (http://struts.apache.org/), there's a property named struts.multipart.maxSize that controls the size limit for uploading files. By default, the value of this property is 2,097,152 bytes. So, for example, if you try to upload a video file of 3,725,268 bytes, Roller will show the following error message:
In the following exercise, I'll show you how to modify the property's value, so that you can upload videos and files of any size. Time for action – modifying the struts.multipart.maxSize propertyThe struts.properties file is inside Roller's WEB-INF/classes folder. If you are using Windows, you can just open and edit the file; but if you're using Linux, remember you need to have "root" privileges to modify this file.
What just happened?Now you can upload videos or files up to 100 MB in size. However, don't forget the Max File Size limit in the File Upload Settings section. This setting only allows a maximum size of 8 MB for each uploaded file. Just remember that the setting with the smallest value will determine the maximum size of each file to be uploaded. In this case, the Max File Size (MB) setting is just 8 MB, it doesn't matter if the struts.multipart.maxSize is 10 MB or 100 MB, the maximum file size you can upload is 8 MB. If you look at the screenshot in step 2 of the previous section, the struts.multipart.maxSize is 104857600 bytes, or 100 MB (100 x 1024 x 1024). You could also use 100000000 as an approximate value for 100 MB, but if you want to use exact values, apply the following formula: Total bytes = Value in Megabytes * 1024 * 1024 Be careful when changing the size limit for uploading files SummaryIn this article you learned how to upload files to your blog and you also changed the space limit for uploading files to your blog server.You also learned how to use the Insert/Modify Image and Maximize/Minimize Editor buttons from the Rich Text editor. With these two buttons you can insert images and, if they are too big to see in the editor, you can maximize the editor to cover all your workspace area, so that you can manipulate images more easily. If you have read this article you may be interested to view :
Apache Roller 4.0 – Beginner's Guide
About the AuthorAlfonso Romero is a freelance computer consultant and translator from Mexico. He's been working with Linux and open source software since 1999. He started operating his first web server (Apache) from a PC at home, offering free hosting services to experiment with Postfix, Squirrel Mail, MySQL, Apache, Tomcat, and Virtual Hosting. Since then, he's been working as a computer consultant for several clients in Mexico – writing Java, C++, and Web applications. Since 2000, he has worked for Pearson Education in Mexico as a computer books freelance translator and consultant. His latest book translations are the Spanish versions of Java How to Program, Seventh Edition, from Deitel & Deitel, and C++ How to Program, Sixth Edition, also from Deitel & Deitel. Al enjoys writing tutorials and teaching about Java, C++, PHP, the Apache Web server, Tomcat, MySQL, Web applications like Apache Roller, and all of the wonderful open source applications used today, and when he's not experimenting with new trends in Open Source applications, he enjoys playing his electric guitar. Books from Packt
|
|
| ||||||||