Difference between revisions of "18 September 2007"
From Organic Design wiki
(News: Dynamic image resizing via URL) |
(use OD example URL's now) |
||
Line 1: | Line 1: | ||
{{news|title=Dynamic image resizing via URL|img=|msg= | {{news|title=Dynamic image resizing via URL|img=|msg= | ||
− | + | The OrganicDesign wiki now does URL-based image resizing on the fly like WikiMedia as in the following example URL's. You can change the number of pixels to anything and it will return the image at that size. | |
− | * | + | *{{SERVER}}/files/thumb/b/ba/Udegawa.jpg/100px-Udegawa.jpg |
− | * | + | *{{SERVER}}/files/thumb/b/ba/Udegawa.jpg/200px-Udegawa.jpg |
− | * | + | *{{SERVER}}/files/thumb/b/ba/Udegawa.jpg/314px-Udegawa.jpg |
This process uses the ''/wiki/thumb.php'' script which accepts two query-string parameters, '''f''' for the name of the image and '''w''' for the width of the re-sized image to be returned. Mod-rewrite can then be used to map requests to re-sized thumbnails to the script, eg: | This process uses the ''/wiki/thumb.php'' script which accepts two query-string parameters, '''f''' for the name of the image and '''w''' for the width of the re-sized image to be returned. Mod-rewrite can then be used to map requests to re-sized thumbnails to the script, eg: |
Latest revision as of 09:02, 18 September 2007
Dynamic image resizing via URL
The OrganicDesign wiki now does URL-based image resizing on the fly like WikiMedia as in the following example URL's. You can change the number of pixels to anything and it will return the image at that size.
- https://organicdesign.nz/files/thumb/b/ba/Udegawa.jpg/100px-Udegawa.jpg
- https://organicdesign.nz/files/thumb/b/ba/Udegawa.jpg/200px-Udegawa.jpg
- https://organicdesign.nz/files/thumb/b/ba/Udegawa.jpg/314px-Udegawa.jpg
This process uses the /wiki/thumb.php script which accepts two query-string parameters, f for the name of the image and w for the width of the re-sized image to be returned. Mod-rewrite can then be used to map requests to re-sized thumbnails to the script, eg:
RewriteCond %{REQUEST_URI} ^/files/thumb/./../.+?([0-9]+)px-(.+)$ RewriteRule ([0-9]+)px-(.+)$ /wiki/thumb.php?w=$1&f=$2 [L]