Adding Images¶
*** Settings ***
Resource plone/app/robotframework/server.robot
Resource plone/app/robotframework/keywords.robot
Resource Selenium2Screenshots/keywords.robot
Library OperatingSystem
Suite Setup Run keywords Suite Setup Test Setup
Suite Teardown Run keywords Test teardown Suite Teardown
*** Variables ***
${FIXTURE} plone.app.robotframework.PLONE_ROBOT_TESTING
@{DIMENSIONS} 1024 768
@{APPLY_PROFILES} plone.app.contenttypes:plone-content
*** Keywords ***
Suite Setup
Run keyword if not sys.argv[0].startswith('bin/robot')
... Setup Plone site ${FIXTURE}
Run keyword if sys.argv[0].startswith('bin/robot')
... Open test browser
Run keyword and ignore error Set window size @{DIMENSIONS}
Test Setup
Import library Remote ${PLONE_URL}/RobotRemote
Run keyword if sys.argv[0].startswith('bin/robot')
... Remote ZODB SetUp ${FIXTURE}
${language} = Get environment variable LANGUAGE 'en'
Set default language ${language}
Enable autologin as Manager
${user_id} = Translate user_id
... default=jane-doe
${user_fullname} = Translate user_fullname
... default=Jane Doe
Create user ${user_id} Member fullname=${user_fullname}
Set autologin username ${user_id}
Test Teardown
Run keyword if sys.argv[0].startswith('bin/robot')
... Remote ZODB TearDown ${FIXTURE}
Suite Teardown
Run keyword if not sys.argv[0].startswith('bin/robot')
... Teardown Plone Site
Run keyword if sys.argv[0].startswith('bin/robot')
... Close all browsers
Adding images to a Plone web site is a basic task that may involve a little work on your local computer, but is essential, because photographs, maps, and custom graphics are so important on web sites.
Note
**Remember to use web-standard file formats for all images. Acceptable formats include: JPG, JPEG, GIF, and PNG.
Do not use BMP or TIFF formats as these are not widely supported by web browsers, and can lead to slower websites.**
When you are ready to upload an image, use the Add new... drop-down menu.
After clicking to add an Image, you’ll see the Add Image panel:
The Title and Description fields (field, as in “data input field”) are there, as with adding a Folder, and at the bottom there is a place to upload an image. Let’s look at the three input fields individually:
- Title - Use whatever text you want, even with blanks and punctuation (Plone handles web addressing).
- Description - Always a good idea, but always optional. Leave it blank if you want.
- Image - The Image field is a text entry box along with a Browse... button. You don’t have to type anything here; just click the Browse button and you’ll be able to browse you local computer for the image file to upload.
For images, at a minimum, you will browse your local computer for the image file, then click Save at the bottom to upload the image to the Plone web site.
You’ll have to wait a few seconds for the upload to complete. A preview of the uploaded image will be shown when the upload has finished.
Images and files that you upload into Plone have their IDs (URLs) based on the title that you give to the image (instead of the file name of the image or file).
However, if you leave the title empty, the name of the item will default to the name of the file.