CapSee: Mac OS X Caps-Lock Bezel Identifier

Gotta love people who think about the big fixes to little problems!

threemagination :: web.mobile.social..

Typography Notes

What is there is just as important as what isn’t there.
Tracking lower text isn’t evil, but do it appropriately.
No rulebook to kerning text, it’s YOUR eyes that are the judge.

Raphaël—JavaScript Library

Well I must say that this is pretty cool!
Adobe Flash .. your days are numbered, the only thing you’ll be good for is video,.. then again, html5 has that too.

Raphaël—JavaScript Library.

Rip-Off Commercialized Twitter Backgrounds

If you’re a multi-window user (windows not maximized to full screen) or have a computer with a lower resolution and navigate to anybody’s Twitter page, you may have problems viewing their background image because of the twitter page framework that overlays on the page.

I came across a couple blogs that solely advertised their services of creating eye-catching, advertising backgrounds for anyone’s Twitter page.

This my friends, is a HUGE rip-off – and here’s why:

  1. Twitter’s backgrounds are left aligned, yet their content framework is center aligned. This will always block the background at inconvenient proportions.
  2. If you try to display information like phone numbers, email addresses, or website addresses in the background picture (as a result of point 1) will be cut off or impossibly unreadable due to the maximum amount of space available between the left side of the page and the left side of the content framework.
  3. People who are savvy enough to use Twitter, don’t even use the Twitter website, in favour of social media aggregator/updater apps. They sanitize the content to just the Tweets alone, so the backgrounds aren’t even seen.

I don’t have statistics on how many people use Twitter, what their resolutions or screen sizes are, or what apps they use to aggregate Twitter with, but not once have I ever been impressed with someone’s twitter background that has advertising material to promote themselves. Phone numbers, email or website addresses are constantly cut off, and even photos of the Twitter profile user are cut off or whatever they are trying to sell is cut off or blocked by the Twitter content framework.

Twitter needs to add a little more customization to their user profile stylesheet management first before I would ever consider using the background of my Twitter page as another avenue to advertise myself.
Instead, for my Twitter profile, I have ingeniously used one of my artwork pieces and created a simple pattern out of it; there isn’t any important information being cut off, and aesthetic quality of the background image adds a truly unique expression of creativity.

And those other people who are charging money to create custom Twitter backgrounds, I tip my hat off to you; you’re making money from being scrupulous thieves and selling graphics that don’t do their job very well. ;-)

The following screen shots were taken at the very popular 1024×768 resolution.

Get URLs, Captions & Titles for Images Attached to Posts in WordPress

I’ve been working on a new WordPress theme for my client that involves a billboard concept where certain posts are categorized as homepage billboard items, and those post items have images attached to them within the Media gallery of WordPress. I found out how to pull out the URI address of the images that are attached to the posts, but it took me some time to figure out how to get the Title, Caption and Description text associated directly with that image attachment.

I borrowed most of my code from here, but I think my example illustrates the concept of retrieving the data needed much easier.

General Code Concept

$size = "thumbnail"; // options: thumbnail, medium, large, full
$args = array(
'numberposts' => null, // change this to a specific number of images to grab
'post_parent' => '25',
'post_type' => 'attachment',
'nopaging' => false,
'post_mime_type' => 'image',
'order' => 'ASC', // change this to reverse the order
'orderby' => 'menu_order ID', // select which type of sorting
'post_status' => 'any'
);
$attachments =& get_children($args);
if ($attachments) {
foreach($attachments as $attachment) {
foreach($attachment as $attachment_key => $attachment_value) {
$imageID = $attachment->ID;
$imageTitle = $attachment->post_title;
$imageCaption = $attachment->post_excerpt;
$imageDescription = $attachment->post_content;
$imageAlt = get_post_meta($imageID, '_wp_attachment_image_alt', true);
// $imageAlt = $attachment->image_alt; // not sure about this one
$imageArray = wp_get_attachment_image_src($attachment_value, $size, false);
$imageURI = $imageArray[0]; // 0 is the URI
$imageWidth = $imageArray[1]; // 1 is the width
$imageHeight = $imageArray[2]; // 2 is the height
echo "$imageURI \n";
echo "$imageWidth \n";
echo "$imageHeight \n";
echo "$imageID \n";
echo "$imageTitle \n";
echo "$imageCaption \n";
echo "$imageDescription \n";
if(count($imageAlt)) {
echo $imageAlt;
}// if '_wp_attachment_image_alt' is not set, echo $alt; shows text like 'Array()'
break;
}
}
}
unset($args); // clear out arguments if using code multiple times in a theme

Practical Usage #1

Use the following to iterate all images from a post
Hint: can use the above example's variables to pull additional info for each.

$size = "medium";
$args = array(
'numberposts' => null,
'post_parent' => $post->ID,
'post_type' => 'attachment',
'nopaging' => false,
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID',
'post_status' => 'any'
);
$attachments =& get_children($args);
if ($attachments) {
foreach($attachments as $attachment) {
foreach($attachment as $attachment_key => $attachment_value) {
$imageID = $attachment->ID;
$imageTitle = $attachment->post_title;
$imagearray = wp_get_attachment_image_src($attachment_value, $size, false);
$imageURI = $imagearray[0]; // 0 is the URI
$imageWidth = $imagearray[1]; // 1 is the width
$imageHeight = $imagearray[2]; // 2 is the height
echo "\t\n";
break;
}
}
}
unset($args);

Practical Usage #2

If you want to get a specific image ..

$size = "medium";
$args = array(
'numberposts' => 2, //change this to the image you want
'post_parent' => $post->ID,
'post_type' => 'attachment',
'nopaging' => false,
'post_mime_type' => 'image',
'order' => 'ASC',
'orderby' => 'menu_order ID',
'post_status' => 'any'
);
$attachments =& get_children($args);
if ($attachments) {
foreach($attachments as $attachment) {
foreach($attachment as $attachment_key => $attachment_value) {
$imageID = $attachment->ID;
$imageTitle = $attachment->post_title;
$imagearray = wp_get_attachment_image_src($attachment_value, $size, false);
$imageURI = $imagearray[0]; // 0 is the URI
$imageWidth = $imagearray[1]; // 1 is the width
$imageHeight = $imagearray[2]; // 2 is the height
// move this down below
// echo "\t\n";
break;
}
}
}
unset($args);
echo "\t\n";

The way the code above works is: the foreach loop, loops from the beginning and iterates through, but doesn't output .. until it's done the loop. It loops through 1, populating all of the variables, and then loops through 2, replacing all of the variables with 2's values. Because we changed the number of posts to retrieve, we only retrieve the last one we wanted, in this case the second image!

This can also be changed to work backwards too (ie. we can get the "second last" image). This can be modified to work with any sort of suitable sorting option: alphanumerically, rating, by ID, etc. - all just by changing the orderby and order setting!

Hope this solution works for your custom PHP queries and image retrieval via WordPress' Media gallery.

« Previous PageNext Page »