Displaying an image to be hosted on this site
To display an image in the body of an entry when the image will be hosted by this site, use the Attach: markup. As an example, the image that’s displayed in the upper left corner of the wiki is located in the PmWikiAdmin WikiGroup and is associated with the page called PageHeader. The file itself is called logo2.jpg. To display that on this page I type the following:
see here PmWikiAdmin.PageHeader
The result is:
If all of that seems a bit complicated, read on.
If you have the image on your local hard drive, the easiest and most direct way to get it into the entry is to code the link first and let the wiki guide you. In that case, all you do is code it like this:
When you save the entry you’ll get a link with the file name and an upload symbol attached to it in the same way that you get that little question mark on a link when you add a new page. When you click on that link, the wiki will assume that you now want to upload the image.
At the moment there is a site-word password on uploads and if you don’t have it, you won’t be able to complete the exercise. When a policy regarding uploads is in place this entry will be edited to reflect that. For the moment, clicking that link will first take you to a screen where you enter the password.
You’re now on the upload screen. Because you supplied the file name in your original link that name is already entered in the second field. I told you this was the easy way. Click the Browse button to open a file dialog that will allow you to locate the image on your system and identify it. When this is done, click the Upload button. The wiki will upload the file and put it in the proper folder so that the Category and Page names are taken care of for you. When the wiki reports a successful upload, click on the view link to return to the page and your image should be on display in all its glory.
If you wanted to show a link to the image to allow readers to download it but not actually display the image, you would enclose the markup above in double square brackets as described in the entry on adding a link. Like so:
That would result in a link with the file name as the link text.
If you encounter problems with the upload there are two likely reasons:
- The file is a type that isn’t allowed. The software accepts certain file extensions such as: .jpg, .jpeg, .gif, .txt, .doc, .pdf. Other file types aren’t allowed.
- The file is larger than the maximum allowed. The limit on size is currently set to 150,000 bytes.
Displaying an image hosted on another site
To display an image that’s hosted on another web site, simply enter the fully formed URL. But be advised that doing so without having the site owner’s permission may bring the wrath of the internet gods down on this site. Every time the entry is viewed, we’ll be hitting the original site and using their bandwidth.
To demonstrate, I’ll use an image that I know is cool because I’m hosting it. If I code this:
I’ll get this:
Photo used by permission.
Using an image as a link
To use an image as the clickable item that will take the user to another page - that is, in place of “link text”, the syntax is
[[LinkLocation | Attach:GroupName/PageName/ImageName.ext]] OR
[[LinkLocation | URI/image.ext]]
[[Main.HomePage | Attach:PmWikiAdmin.PageHeader/logo2.jpg]]
[[Main.HomePage | http://www.fluwiki.info/uploads/PmWikiAdmin/logo2.jpg]]
The image can also be scaled (when used as a clickable link OR in any other use) using a width or height formatting directive.
So you can use the image as a %width='50px'%[[Main.HomePage | Attach:PmWikiAdmin.PageHeader/logo2.jpg]]%% thumbnail, inline in text.