|
Cookbook /
UploadPicCompressionSummary: Compress uploaded image files
Version: 7 March 2005
Prerequisites:
Status:
Maintainer: PatrickOgay
Categories: Images, Administration
GoalPictures (jpg, png, gif) should/can be compressed on the fly while uploading (Attach:) SolutionI found a nice working PHP/GD Script on Yuriy Horobey's website http://horobey.com/demos/imgresize/v5/article/article01.html (see also Cookbook/ImagesAutoResizing, which might be very useful for a gallery) The script is a pure php-solution and easy adaptable in the pmwiki environment.
Changement in config.php
# another Entrypoint instead of upload.php:HandlePostUpload */
SDV($HandleActions['postupload'], 'HandlePostUploadImpr');
# Entrypoint and GD-Picture Compression
require("local/resize_image.php");
# Modified Form (from upload.php) for Attach: files.xyz
SDV($PageUploadFmt,array("
<div id='wikiupload'>
<h2 class='wikiaction'>$[Attachments for] \$FullName</h2>
<h3>\$UploadResult</h3>
<form enctype='multipart/form-data' action='\$PageUrl' method='post'>
<input type='hidden' name='n' value='\$FullName' />
<input type='hidden' name='action' value='postupload' />
<table border='0'>
<tr><td align='right'>$[File to upload:]</td><td><input
name='uploadfile' type='file' /></td></tr>
<tr><td align='right'>opt. for Pics width/height</td><td><input
name='w' type='text' size='3' /><input
name='h' type='text' size='3' /> Resize in Pixel, *=calculates automatically
</td></tr>
<tr><td align='right'>$[Name attachment as:]</td>
<td><input type='text' name='upname' value='\$UploadName' />
<input type='submit' value=' $[Upload] ' /><br />
</td></tr></table></form></div>",
'wiki:$[PmWiki.UploadQuickReference]'));
Notes and Comments
Open Issue March 07 2005
ContributorsPatrickOgay - prototype March 7, 2005 |