Advthumbs is a Snippet for MODX Evolution which generates thumbnails on the fly.
Snippet developed by: Lorenzo Stanco.
Download Advthumbs
Demo Advthumbs (Lightbox Gallery)
1. Installation
To install Advthumbs Snippet, follow these steps:
Extract Advthumbs on "sitename/assets/snippets", then go to "Elements > Manage Elements >
Snippets > New Snippet":
Snippet Name: advthumbs.
Snippet Description: Thumbnails Generator.
Snippet code (php): copy the content from "snippet.advthumbs.txt". Save and close.
2. Usage
Examples of Advthumbs usage:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resize`]]" alt="[*pagetitle*]" /> <img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`crop`]]" alt="[*pagetitle*]" /> <img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resizecrop`]]" alt="[*pagetitle*]" /> <img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resizeblack`]]" alt="[*pagetitle*]" /> <img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resizeblack` &watermark=`1`]]" alt="[*pagetitle*]" />
3. Parameter &filename
This parameter is required. Filename lets you specify the path of the image.
You can use it like this: &filename=`[*img1*]`.
4. Parameter &newxsize, &newysize
These parameters are required. Newxsize and Newysize let you specify the image dimensions.
You can use them like this: &newxsize=`250` &newysize=`400`.
5. Parameter &method=`resize`
This parameter resizes the image until it fits into the specified dimensions, without keeping the image proportions.
Advthumbs Call example:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resize`]]" alt="[*pagetitle*]" />
![]()
6. Parameter &method=`crop`
This parameter crops the image until it fits the specified dimensions. Basically this parameter displays the center of the image, the rest of the image is cropped out.
Advthumbs Call example:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`crop`]]" alt="[*pagetitle*]" />
![]()
7. Parameter &method=`resizecrop`
This parameter crops the image and resize it until it fits the specified dimensions, it keeps the image proportions and it center the image exactly in the middle.
Advthumbs Call example:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resizecrop`]]" alt="[*pagetitle*]" />
![]()
8. Parameter &method=`resizeblack`
This parameter resizes the image and keeps the image proportions, the rest of the image is filled in with black (by default). To change the default color, open "advthumbs/class.image.php" and modify line 188, for example you can change from black to white in this way: 0x00, 0x00, 0x00 -> 0xFF, 0xFF, 0xFF.
Advthumbs Call example:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resizeblack`]]" alt="[*pagetitle*]" />
![]()
9. Parameter &watermark=`1`
This parameter, if set to true, adds a watermark in the center of the image. By default, the watermark parameter takes the image path from advthumbs/watermark.png. You can change the path from line 61 in the snippet file.
Advthumbs Call example:
<img src="[[advthumbs? &filename=`[*img1*]` &newxsize=`200` &newysize=`200` &method=`resize` &watermark=`1`]]" alt="[*pagetitle*]" />
![]()
10. Conclusion
What I think work best is: &method=`resizecrop`, because it keeps the right proportions and it cuts the image in the way I want it to be.


whoo
great, thanks for the tutorial! do those images get cached / created on the fly and stored somewhere?
thanks