× This category is read only

About images

12 years 3 weeks ago #607 by Dirk
About images was created by Dirk
Because some users had Questions about the image-functions in JooDB we want to give you some hints about using {joodb path2image} and {joodb path2thumb}.
JooDB has a simple built in image-management. If you edit a Database-entry you are able to upload one additional Image for each entry. The images are stored under /images/joodb/dbXX/imgXX.jpg where XX is either the ID of the Database or the ID of your entry. Make sure your /images/joodb directory is writable.

The image will be resized to two desired sizes for thumbnail and normal image. You can set the maximum width and height in parameters-section of your Joodb-Database. The Original-Image is stored as imgXX-orignal.jpg

How to get the Image into your views?

As described at the help-section {joodb path2image} and {joodb path2thumb} will only print the image-path including the imagename. Something like /images/joodb/db1/img22.jpg for the entry with ID 22. All you must do is insert the {joodb path2image} or {joodb path2thumb} into the SRC or HREF parameter of your template.

If you are using an editor like JCE make sure to switch off code-cleaning. 
Otherwise the editor will destroy your code every time, because 
the URL is not valid.

As you see in the code-example, we link the big image with the thumbnail. If you are using MODAL as classname for your link, the big image will be opened in a modal-box like this.

To make it easier future versions will have a {joodb image} and {joodb thumb} command to print image-elements directly.

Display or link to directly uploaded images/Documents

If you have more than one image or you dont want to upload using joodb you can do it in2 different ways.
1: Your Images/Documents have the id included to the name
If your imagenames are identical exept the ID of the Database you must only insert the id at the right position of your database.

For example: <img src="/images/myimages/{joodb id}-image-001.jpg" />

1: You use an extra field with the filename
Instead of of using{joodb path2image} or {joodb path2thumb} insert the field where your imagename is stored at the right position.

For example: <img src="/images/myimages/{joodb imagename}" />

Take a look at the sample database to understand. The images for this database are stored in /components/com_joodb/sample-images
Of course you can also include Images, Movies or other Documents from other servers by adding the complete URL.

Please Log in to join the conversation.