Categories
General

Up2rand 0.1

Up2rand is sort of a proof-of-concept, but probably actually useful too. It provides a template function that displays random images from those you’ve uploaded using the built-in uploader in WP2 (NOT Photopress). I haven’t tested it extensively, but it seems to work. Obviously, it only works with WP2.

Download Up2rand 0.1: up2rand.zip OR up2rand.tar.gz

Installation and use:

Put up2rand.php in your plugins folder and activate it. Insert up2rand() where you want random images in your template (usually somewhere in your sidebar.php). Without any options you’ll get one thumb, linked to the full image in a popup. To get something else, pass some options:

up2_rand($number_of_images, $before_each, $after_each, $link, $popup, $class);

$number_of_images – number of random images to get (reduced if you don’t have enough)
$before_each – what you’d like to put before each thumbnail (such as <li>)
$after_each – what you’d like to put after each thumbnail (such as </li> or <br />)
$link – whether to link the thumbnail or not (TRUE or FALSE)
$popup – whether to link to a popup or not (TRUE or FALSE)
$class – class to use for the image (you can insert a class in your theme’s style file and use it here)

Here’s an example that gets 2 random images, wrapped with <p></p> tags, linked normally (no popup), and using the ‘randimage’ class.

up2_rand(2,'<p>','</p>',TRUE,FALSE,'randimage');

Categories
General

Save a WMA stream and convert it to an MP3

A WMA stream is like an innocent person imprisoned in a gulag. It is our duty to free them! First, free the music from its streaming prison by capturing it to a WMA file:

mplayer -dumpstream -dumpfile pop_tune.wma mms://gulag.com/pop_tune.wma

(From this page.) It’ll take a while, but you should end up with a file called ‘pop_tune.wma.’ A WMA is like an innocent person on work release from the gulag, wearing a lo-jack that prevents them from walking normally. So, let’s remove the lo-jack by converting the WMA to a WAV:

mplayer -vo null -vc dummy -ao pcm:file=pop_tune.wav pop_tune.wma

(From this page, refined by this reply.) If it worked, you should have a WAV file, which you can easily encode in your favorite non-evil format. You can also just use ffmpeg to turn the WMA file straight into an MP3 (or a ton of other things). This makes a 128kbps MP3:

ffmpeg -ab 128 -i pop_tune.wma pop_tune.mp3

Categories
General

Photopress 0.9

This version includes a few fixes, and a couple of new features. It should work with both WP 1.5.2 and 2.0. If you’re upgrading, make sure to de-activate and re-activate to update the database table.

New features and fixes:

  • Added a category slug field and code to use it – this should fix the permalink problems related to strange characters in category names.
  • The popup tool shouldn’t throw Javascript errors anymore. I also added code to suppress the Browse tab if the tool is launched from the Manage page.
  • There’s now some Javascript to change the Insert buttons a little to show users which images they’ve inserted.
  • The popup tool’s Browse tag has a dropdown category menu that will display images images in a single category.
  • The random image template function (pp_random_image_bare) can now display multiple random images. There are some details about it in the readme and the Photopress page.

Download Photopress 0.9: photopress.zip OR photopress.tar.gz

As usual, let me know what’s broken or needs work. Thanks again for all the bug reports and feature ideas!

Categories
General

Photopress 0.8.5

This version is still mostly bug fixes, so I’m sticking with 0.8.x. It should work well with both WordPress 2.0 and 1.5.2.

New features and fixes:

  • Fixed a bad bug in the duplicate renaming function. Also added a maintenance function to clean up filenames if you’ve uploaded a few with bad names.
  • Fixed the bug Nonni found where ampersands in category names messed things up. Photopress should now handle ampersands in category names just fine.
  • Fixed a few problems with permalinks. They work differently in WP 2.0, so I’m handling it with some version-specific code, which sucks.

Download Photopress 0.8.5: photopress.zip OR photopress.tar.gz

As usual, let me know what’s broken or needs work. Thanks again for all the bug reports and feature ideas!

Categories
General

Fixing Photopress for WP 2.0

I’m working on getting Photopress to work well with WordPress 2.0, but it’s not quite there yet. If you’d like to try what I’ve done so far, download photopress-wp2.zip. Note that you’ll need to disable the rich text editor for image inserts to work right.

Update: I’ve replaced the above file with a new version that seems to work better. Image inserts should work under the rich text editor too now.