Links for December 29th through January 28th Links for December 29th through January 28th
  • Home
  • Posts
  • Home
  • Posts

PHP

Links for December 29th through January 28th

Links for December 29th through January 28th:

  • Dramatic Gritty Effect In this tutorial we’re going to show you how to add a dramatic, gritty, bronzed effect to your images.
  • Propel Propel is an Object-Relational Mapping (ORM) framework for PHP5. It allows you to access your database using a set of objects, providing a simple API for storing and retrieving data.
  • The Top 500 Worst Passwords of All Time Passwords to try when I desperately need to get onto a locked Wifi network for some reason. Don’t tell anybody.
  • Foreign Exchange Rates (FOREX) XML Feed or CSV Feed Free for commercial or non-commercial use, updated daily, XML/CSV format
  • 10 Places To Publicize Your iPhone App A list of iPhone App review/gallery sites
Read More

Elegant Grunge 1.0 released

A significant update to my WordPress theme, Elegant Grunge, has been released. New features and fixes include:

  • Configurable sidebars! Choose from no sidebar, a sidebar on the right (the standard layout), or a double sidebar on the right!
  • Support for WP 2.7 paginated and threaded comments
  • Support for a custom header image – just enter a URL to an image, typically a transparent PNG, and it will appear in the header instead of the text (SEO friendly)
  • Some bug, compatibility and i18n fixes

Note: If you have problems with this theme, please post your question at the WordPress forums. Please don’t contact me directly, as I don’t have the resources to help you.

Read More

RSS aggregation for PHP

I have written a mechanism in PHP that can take several RSS feeds, filter and manipulate them, and re-display them in either RSS or straight HTML.

This can also manipulate content (through the preg_replace function, and configurable per-feed), such as removing names from Twitter entries. I’m using it on loopyapp.com to show all relevant items from both this blog and my Twitter feed automatically, as an alternative to creating a separate blog. I’m also using it on this blog, to incorporate blog entries and Twitter postings.

It uses the MagpieRSS RSS parser for PHP, which provides some nice functionality, including caching.

Here’s the code: aggregate.zip

To use it, unzip it to somewhere in your webroot, then edit aggregate.php and possibly rss.php to set your configuration. Make sure that either the aggregate directory is writable, or create a ‘cache’ directory within and make that writeable, to enable caching. Point your web browser to the rss.php file to immediately view an RSS feed aggregating your supplied feeds. To add a link to the RSS from a website, add it in the header:

 

To include content in a website, the provided render_aggregate_items function will do most of the work, or you can write your own rendering code. You just have to include the file, use the functions to obtain and draw the content, and then provide your own CSS styling. Example:

<div class="items">
 
</div>

<div class="items"> </div>

A more comprehensive example is in sample.php.

The code is GPL, so use it however you want – keep the header comments there, though.

Read More

Links for November 13th through November 17th

Links for November 13th through November 17th:

  • How to Price Your iPhone App out of Existence Write-up on the dangers of pricing an iPhone app too low, and the need to 'correct' the market
  • Open Radar Community-driven, open Apple bug reports
  • Free Australian Postcode location data "…Both the original CSV is available zipped below and contains Postcode, Suburb, Latitude and Longitude, a MySQL dump of the data is also available in a Zip file below. You can also download the PHP functions we coded to interface with the MySQL database. Simply call the postcode_dist() function with the two postcodes as shown in the example and you'll have a result in Kilometers returned quite quickly, these functions are freely available under the BSD licence."
Read More

A OS X service to encode HTML characters

I find myself frequently writing HTML code in comment forms which support use of HTML formatting, which means that I have to encode the html entities if I want them to show up (as in representing ‘>’ with ‘&gt;’, for example).

This gets rather tiresome, particularly if there’s a fair chunk of text to encode by hand.

I used the always-useful ThisService app with a short PHP script which does a htmlspecialchars() on whatever’s passed to it, to create a OS X service called ‘Encode HTML‘. Put it in your Library/Services directory, possibly log out and back in again, and you’ll be set.

Select the text to encode, click the system menu, Services, Encode HTML, and it’ll be automatically encoded in place.

Read More

Some useful mini-plugins for WordPress

Originally for my own use, I put together a couple of WordPress plugins, which I thought I’d make available in case they were useful to anyone else.

Google AdSense shortcode

This is the simplest plugin, which provides an ‘adsense’ shortcode to output a Google ad. To use it, use Google’s tools to create the ad, then paste it into the php file where indicated, then put {adsense} (replace the curly braces with square brackets) in posts/pages where you want the ad to appear (remove the spaces around the square brackets).

adsense.php.zip

And now for a demo + shameless attempt at monetization:

Media player

This one is useful if you occasionally post a video file on your blog, and host it locally. If you use video more frequently, there are plugins that probably are more suited, but I personally didn’t want the overhead, and I wanted to store videos in the standard upload locations, instead of having a separate repository, which seems to be what other plugins do.

This one uses the JW FLV player, provided in the plugin. Use something like:

{media source="http://my.site.com/path/to/video.flv" width="400" height="308" preview="http://my.site.com/path/to/preview.jpg"}

(replace the curly braces with square brackets)

mediaplayer.zip

I used this just the other day on a post demonstrating the output of the simulator I’ve written for my PhD.

Music player

This is the plugin that renders the content for my music page, as well as providing mini-players for other posts. Give it a path to a directory, and it will display all mp3 files in that directory with flash players based on the XSPF Web Music Player. Recently-added mp3 files will be marked as ‘New’. Use something like:

{musiclist path="path/to/my/music"}

(replace the curly braces with square brackets; add optional nolink=”true” parameter to avoid linking to the mp3 files from their titles)

For just one track, use:

{audio source="path/to/audio.mp3"}

musicplayer.zip

Read More

Twitter posting lists with images

200810161358.jpg

Recently I released some code to discover and embed Twinkle images linked from Twitter postings, and released a modification to Ricardo González’s Twitter for WordPress plugin which uses it.

I’ve now implemented support for Twitpic as well.

Grab the modified WordPress plugin here:

twitter-for-wordpress-plus-images-v0.2.6.zip

After installation, add the widget and make sure ‘Discover images’ is ticked.

For non-Wordpress users, the base code is also available here:

TwitterImageUtil.class.php-v0.2.6.zip

Include it in your twitter list source code, and use it as a filter for the message content. Something like:

$message = TwitterImageUtil::processContent($message, $mysql_database_handle);

Some configuration is possible – see the header comments for more details.

The code will create a thumbnail of the image, and store it locally. It’ll also cache the results in a MySQL database for speed. It supports Lightbox, too – just supply the relevant flag to turn it on.

Updates

  • Version 0.2.6: Bugfix for posts with both images and @mentions
  • Version 0.2.5: Bugfix from prior version, plus compatibility fix for Twitpic changes
  • Version 0.2.4: Updated to match Twitter for WordPress v1.9.2: Compatibility fix for WP 2.7
  • Version 0.2.3: Another update, chasing the moving target that is Twitpic
  • Version 0.2.2: Updated to match Twitpic’s new image storage using Amazon S3.
Read More

Advanced web templating with PHP and regular expressions

This post describes a method to gain more control over the styling of images for web templates/blog themes, using a bit of Regular Expression magic. This is the technique used for my recent theme, Elegant Grunge.

You’ve just designed the most beautiful template ever – pleasing composition, clean lines, smooth colours and gradients and an awesome typeface. You apply it as the theme for your blog, or release it to the community, and there is much rejoicing.Example of the 'SH Trocadero' WordPress theme with image

Then you or someone else inconsiderately puts a photograph into a post – disaster! That nasty square of graphic just destroyed your composition, and the page is unbalanced and suddenly looks terrible.

Images are particularly tricky to make work with a theme, mostly because they’re so unpredictable. With text, it’s easy to control the way it looks. With images, they can be any colour or shape, many of which will break the composition of a theme, especially if the design elements of the theme contains irregular lines.

A big impediment to making images work is the limitations introduced by the current versions of CSS: All you can really do is provide a square border, possibly with some padding. That’s it, unless you’re willing to manually add tons of markup around images every time – and willing to make your users do it, if you’ve released a theme.Example of images in the "Green Light" WordPress theme

Some people will carefully Photoshop-up their images to make them fit – Webdemar (who made the theme I first used on my blog) does this, for example, and it looks great. That’s a lot of work, though, especially if you make frequent posts with images!

If you’re a theme designer, there’s an easier way to make images work.

Read More

Hi! I'm Michael Tyson, and I run A Tasty Pixel from our home in the hills of Melbourne, Australia. I occasionally write on a variety of technology and software development topics. I've also spent 3.5-years travelling around Europe in a motorhome.

I make Loopy, the live-looper for iOS, Audiobus, the app-to-app audio platform, and Samplebot, a sampler and sequencer app for iOS.

Follow me on Twitter.

Posts pagination

« 1 2 3 4 »
© 2021 A Tasty Pixel.