- How to order images and galleries?
- How to disable creation of resized images?
- How to set folder title image without displaying the image inside?
- How to configure DAlbum to use ImageMagick on Microsoft IIS?
- How to use NetPBM for image resizing?
- How to prevent direct image linking (hot linking)
How to order images and galleries?
Albums and images are sorted alphabetically by their filenames. For example,
images "first.jpg", "Second.jpg", "Third.jpg" and "Fourth.jpg" will be sorted
as follows:
-
Fourth.jpg
-
Second.jpg
-
Third.jpg
-
first.jpg
To change the order of images, rename them as 001-first.jpg, 002-Second.jpg,
003-Third.jpg and 004-Fourth.jpg correspondingly. There are many
utilities available which can simplify the renaming process - check
Batch Renaming.
To hide the leading digits from your users without
manually editing every image caption in .albumdef.ini, uncomment and modify filename2title
function in your custom.php file as follows: function filename2title($filename)
{
return ereg_replace( "^[0-9]+-", "", getfname($filename) );
}
This way your album users will see your images as "first", "Second", "Third"
and "Fourth" and in appropriate order.
You can also define your own sorting method by overriding CAlbum::Sort method
in derived class.
This example adds DescendingOrder custom field to albums. When it is set to "1"
in album properties, album contents will be sorted in descending order:
How to disable creation of resized images?
DAlbum does not create a resized image if the original image is smaller
than resized image size. Edit your config.php file and set
$g_sResizedXSize=50000;
$g_sResizedYSize=50000;
How to configure DAlbum to use ImageMagick on Microsoft IIS
- Set
$g_sResizeMethod="IM"; in config.php
- Edit $g_sConvertPath variable in config.php and set it to location where ImageMagick is installed. For example
$g_sConvertPath="c:/ImageMagick/convert.exe";
Remember to replace all backslashes with forward slashes.
- You need to give IIS user account access rights to your C:\WINNT\SYSTEM32\Cmd.exe. The best way to do it is go to your IIS Admin, select reindex.php and set it to run as another user (not IUSR_xxx). More secure solution would be to disable anonymous access to reindex.php completely and set authentication on. Then you will be asked for username and password for Windows account every time you reindex the photo album.
- In order to run DAlbum test you will need to configure test.php account the same way as reindex.php in step 3.
- Ensure that temp directory is writeable by the same account.
How to set folder title image without displaying the image inside?
Create a file named:
- .folder.jpg
- .folder.gif
- .folder.png
- _folder.jpg
- _folder.gif
- _folder.png
inside your folder. This file should be smaller
or equal to your configured thumbnail size (default 128x128 pixels).
How to use NetPBM for image resizing?
If your host has NetPBM graphics software package
installed, you can use it to create thumbnails and resized images:
- Download and extract rsnetpbm.pl from rsnetpbm.zip
into DAlbum root directory. You may need to edit this file and
set directory where NetBMP package is installed.
CHMOD rsnetpbm.pl to be not executable (ex. 444).
- Edit your config.php file as follows:
- Reindex.
Using a similar approach any command-line image resizing toolkit can be used with DAlbum.
How to prevent direct image linking (hot linking)
As your public images can be accessed by using a URL (ex.
www.mysite.com/photo/photo.php?file=/folder1/test.jpg),
your site may become subject to direct linking. This happens when somebody posts
URL of your image on another site or forum and hundreds of people suck your bandwidth
without even visiting your site.
To disable direct linking to your images, edit your config.php and ensure that the following
variables are set as follows:
$g_bDirectAccess=false;
...
$g_bHTTPAuth=false;
This way DAlbum code is called every time an image is downloaded.
Then add the following code snippet to custom.php:
This code forces all DAlbum pages except photo.php to set a one-hour cookie on every visit.
If there is a direct link to photo.php, the cookie will not be set and "404 Page not found"
error returned to client. Page referer check is also performed to enable users with disabled cookies to
browse your site.
|