Cufón, an Alternative to sIFR for Image Replacement

I was struggling with sIFR yet again this morning, an odd WSOD in IE7 and other problems. John Haas showed me Cufón as a replacement, and I was quickly impressed with its potential. The project promises cross-browser compatibility with no plug-ins (bye, bye, Flash!), as well as being fast and easy.

Image Replacement with Cufon!

So I gave it a whirl. At first, I opened a feature request at the Dynamic Rendering module to add support, at the same time digging into the module to see what I would need to add for this new plugin.

However, in the end, I decided the approach was too heavy handed. All I needed to do was add a couple of (very small) scripts to the theme.

First, you need to download the cufon-yui.js script. Then you'll take your TTF or OTF font and run it through the provided generator, resulting in a small (<26kb) script that embeds your font (such as A_Charming_Font_400.font.js in this example).

I just dropped the required javascripts into the theme folder, and modified the theme's info file:

  scripts[] = cufon-yui.js
  scripts[] = A_Charming_Font_400.font.js
  scripts[] = mytheme.cufon.js

And finally drop something like the following in the new mytheme.cufon.js script referenced above. (Just use jQuery selectors for this part.) You can look in the generated javascript if you're not sure what fontFamily to replace.

  if (Drupal.jsEnabled) {
    $(document).ready(function() {
      Cufon.replace('h2.title', { fontFamily: 'A Charming Font' });
      Cufon.replace('#big-title', { fontFamily: 'A Charming Font' });
      // Note you can add other generated fonts as well, such as below...
      Cufon.replace('#fancy-title', { fontFamily: 'Some Other Font' });
    });
  }
That's it! No flash required, no "flash of screen" associated with sIFR. It just works. (And did I mention fast?)

Media Sprint TODO?

The Media Sprint 2009 Wiki has a rough outline, based on an earlier document started by arthurf, but needs some serious fleshing out. I plan to begin working in earnest again on the sprint later next week and the following (am trying to slot 3-4 solid working days towards it).

There are also several volunteers who have offered to help over the coming weeks as well. We need to try to build some organization.

I'm up against a couple of roadblocks with both the Media module and its included Resource module, and need some advice to go forward with those.

Particularly, I'm not sure what's intended during media_ahah_formatter_load(), which is what, I imagine, needs to both save the gathered resource into the file system, and make sure it adds to the field or attachment in the form. Arthur's also mentioned some difficulties in conceptualizing how we'll know what metadata to collect between submission and uploading.

I've also run into problems with the Resource module in my starts for Media: YouTube. For instance, we have to instantiate some classes during hook_boot, but don't have access to drupal_get_path() at that phase of the boot process. I've created a hackish work-around, where we store the module's path during installation, and check in hook_exit if the path has changed so we can set the new variable. I'm convinced it's not the best method, but haven't figured another yet.

So I'm opening this thread (at gdo) for questions of this nature, hoping people can help out, or at least take a closer look at the modules to help flesh out a TODO list for myself and other interested developers. I personally will have a lot more questions as I go along.

Thanks,
Aaron

(Cross-posted at Groups.Drupal.org.)

Media: YouTube (PHP Stream Wrapper)

The future of Drupal Multimedia is now!

The Media Sprint: 2009 is continuing to build up steam. I met with the folks at Zivtech in Philly yesterday, and we banged on the Media module some more. Jody Hamilton made improvements, fixing up a few things, ensuring the browser works with multiple fields, etc.

I continued backporting the Resource module (bundled with the module) to Drupal 6, to enable PHP Stream Wrappers. After that, I started work on the new Media: YouTube module and stream wrapper.

Here's a hint of how difficult it will be to implement a new stream wrapper for another third party media provider. (Drum roll, please...)

<?php
// $Id: ResourceYouTubeStreamWrapper.inc,v 1.1 2009/01/27 21:29:50 aaron Exp $

/**
*  @file
*  Create a YouTube Stream Wrapper class for the Media/Resource module.
*/

/**
*  Base class for the YouTube PHP Stream Wrapper.
*/
class ResourceYouTubeStreamWrapper extends ResourceReadOnlyStreamWrapper {
  private
$base_url = 'http://youtube.com/watch';
}
?>

Any questions?

Well, okay, so there will be a little more, such as parsing the URL of a passed media page. But really, it's not going to be much more than that to tie in the basic functionality of Embedded Media Field into the new "File Browser of the Internet" that we're creating with the Media Sprint.

(Next up for this particular wrapper: tie it into the YouTube API so we can save uploads to YouTube with the file system...)

Media Sprint at Zivtech!

Tomorrow (January 27, 2009) we'll be continuing the Media Sprint 2009, at the Zivtech office in Philly. Our stated goals: document the heck out of the Media module, and get a new PHP Stream Wrapper ready for it. And afterwards, at 3:30 PM EST, we'll meet with the Drupal Dojo to teach interested folks how to write their own!

Zivtech

For more information, see Media Sprint Wiki at http://groups.drupal.org/node/18063, Documentation at http://drupal.org/node/356802, and Media Module at http://drupal.org/project/media. You can also view a Proof of Concept video at http://www.24b6.net/2009/01/09/media-sprint-prototyping.

Media Sprint 2009 Panel at DCDC

New panel at DrupalCon DC: Media Sprint 2009!

This January, several developers met in NYC and virtually to launch an effort to overhaul media and file handling in Drupal. The ongoing work is now coming to fruition, and this panel will present the changes and their implications to the community. Using the Media module, it's now possible for a user to use a single GUI to manage all files, including external sources such as a CDN, Amazon S3, and YouTube. We will examine the underlying PHP Stream Wrappers and Media API that makes this possible.

I will join Arthur Foelsche and Darrel O'Pry to help present this topic.

Drupal Dojo: Media Sprint Recap

Here's the DimDim recap of the first Drupal Dojo session of the year, where Arthur Foelsche (arthurf) and I recapped the initial push in the ongoing Media Sprint! You can skip the first few minutes; the action doesn't really begin until 3:50.

See the recap...

Media Sprint Recap on Drupal Dojo! (Forthcoming)

Arthur and I will co-present a recap of last week's exciting Media Code Sprint, held in various offices in NYC! We'll be doing this with the Drupal Dojo, using DimDim.

Media Code Sprint Recap
Tuesday, January 13, 2008 at 3:30 PM (EST)

Why You Want to Be There

  • Because you want to learn about the future of multimedia in Drupal.
  • Because you want to help transform multimedia handling for Drupal.
  • Because everything you thought you knew about Drupal and multimedia is about to be obsolete (and why that's a good thing)...

I'll post a synopsis and schedule in the morning, so stay tuned!

Media Code Sprint (January 2009)

Wrapping up Day 1 of the Media Code Sprint for January 2009! (Edit from 2008... doh!) I'm in the Advomatic NYC offices with Arthur Foelsche (arthurf), Roger López (at http://drupal.org/user/67977), Darrel O'Pry (dopry), and Owen Osborn (oweno).

Today's been a great brain-storming day, figuring out our plans for the weekend. For those of you who don't know about this media sprint, among the stated goals is to backport the File API from Drupal 7 to Drupal 6, get the major media modules using that, and creating a GUI to wrap around it. You can see more at the Media Sprint wiki.

The discussions have been amazing to be part of. We plan to create a new form element and field, using FileField as its core, and create a registry API on top of that, using PHP Stream Wrappers (built into PHP 4+).

Initially, we would have an upload box created with FileField. Then tabs would be created as module add-ons, for local files as thumbnails, Embedded Media Field text field for third party URL's, YouTube or Flickr searches, etc. This would be similar to what I used for Video Uploads/Embeds at YouDrup. In the future, this could also be replaced with a flash uploader for multiple uploads and progress (which can only be done in PHP with APC enabled), such as is done with Kaltura.

More tomorrow! We're meeting at Advomatic again, and in #drupal-dev at IRC. Saturday we'll meet at Sony, and an as-of-yet undetermined Drupal shop on Sunday.

Don't Panic, It's Drupal!

Here's a graphic I made for the Do It With Drupal conference, where I built YouDrup, a YouTube clone with Drupal.

Don't Panic, It's Drupal!

Enjoy!

Syndicate content

The Society for Venturism has chosen me as the recipient of its charity for this year, to hopefully offer me cryonic preservation when the time comes. And this month, Longecity, an excellent forum for the discussion of issues related to extending the lifespan of humans, has offered up a matching grant of up to a thousand dollars to help out! So help out! Please.