Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.5.1
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 2 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

mdp_automatic_randt mod

TXP Hack to automatically create thumbnails from uploaded JPEG’s

This is another TXP g1.19 hack that lets you automatically create thumbnails when a JPEG image is uploaded. It also will resize the uploaded image if it is too large. This makes uploading photos really easy, because the server will handle everything and help you save space by not keeping high resolution photos on your account.

(For a version that works in RC3, see Daniel’s customized mdp_automatic_randt.)

Options

In version 0.5 there are four options that can be found on lines #13-16:

  • “RT_RESIZE” => Image width, in pixel’s, that you want the uploaded image to be resized to. If the original is smaller than this, it won’t be resized.
  • “RT_TW” => Width of the thumbnail, in pixel’s. Setting to -1 will disable thumbnail creation.
  • “RT_TH” => Height of the thumbnail, in pixel’s. Setting to -1 will also disable thumbnail creation, and setting to 0 will make the thumbnail the same aspect ratio as the original image. Setting to the same value as “thumbw” will create square pixel’s, any other values will make the height that value (may cause distortion).
  • “RT_IMAGICK” => Enable ImageMagick or not, setting to 1 (default) will turn ImageMagick ON.

Installation

Installation isn’t as easy as a regular plugin, but trust me you can do it!

  1. Download mdp_automatic_randt
  2. Rename /textpattern/include/txp_image.php to txp_image.original
  3. Put “mdp_automatic_randt.v0.5.1.txt” into /textpattern/include/
  4. Rename “mdp_automatic_randt.v0.5.1.txt” to “txp_image.php”

Additional Information

If your server has ImageMagick installed (many do), I would highly recommend using ImageMagick instead of GD to resize and create thumbnail’s. You can do this by going to line #370 and setting $im equal to 1. Doing so should produce higher quality images, but they will also be bigger in size (not by a large margin). You can adjust the quality produced by changing “$funct[“resize”]($path,$full)” to be “$funct[“resize”]($path,$full, QUALITY)” where QUALITY is an integer from 1-100 and “$funct[“thumbnail”]($id,$thumbw,$thumbh)” to “$funct[“thumbnail”]($id,$thumbw,$thumbh, QUALITY”.

Article Request Count:

Archived [?]: replaced by mdp_automatic_randt for RC3

Initially released:
2004-06-07
Posted here:
23 Mar 2005
Article modified:
20 Jan 2008

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern