Bringing High Tech to the Low Tech World.

Extract Image From WordPress Post

Tags: , , ,
Posted in Blog, Hints, Technical · April 28th, 2010 · Comments (0)

This will extract an image from a wordpress post. You can use it in the loop with get_content() or get_excerpt(). There are a hundred other different uses for something like this as well. Good snippet to have.

// Pull first image thumbnail from post if none exist, default to a category image.
//
// Required:
$pattern = '/<img[^>]+src[\\s=\'"]';
$pattern .= '+([^"\'>\\s]+)/is';
// Optional:
$style = "height:50px;width:60px;margin-top:15px;";
$defaultImgURL = "http://www.yoursite.com/image/url.png";
$imgAlt = "Alt Text Here";
$imgID = "";
$imgName = "";
// If we have an Image ...
if(preg_match($pattern,get_the_content(),$match)) {
	echo "<img alt=\"\" style=\"" . $style . "\" src=\"" . $match[1] . "\" />";
// If there is no img Tag ...
} else {
	echo "<img alt=\"\" style=\"" . $style . "\" src=\"". $defaultImgURL  ."\" />";
}
// Thats it!
Tags: , , ,
Posted in Blog, Hints, Technical · April 28th, 2010 · Comments (0)

Site Update

Tags: , , ,
Posted in Blog, Updates · April 26th, 2010 · Comments (0)

I have been working on a few customizations for the site. You will notice some appearance changes, and some more content. I don’t have much time lately to do a lot of the changes all at once, so you will notice them slowly appear. I have a database application in development right now, and it takes most of my time.


*UPDATE 4/27/2010: I have added jQuery and a few choice libraries to the load. All are working as of this update. As you can see these posts are now rounded, and collapsable. I love building this WordPress Template from the ground up. Gives me so many more design/style options. I can’t wait till its all done though!

Tags: , , ,
Posted in Blog, Updates · April 26th, 2010 · Comments (0)

Megahurts FRC Team #2219: Breakaway 2010

Tags: , , , , ,
Posted in Blog, Technical, Videos, robotics · April 9th, 2010 · Comments (1)

Tags: , , , , ,
Posted in Blog, Technical, Videos, robotics · April 9th, 2010 · Comments (1)

Black Sheep Coal Fired Pizza

Tags: , , ,
Posted in Blog, Pictures · April 6th, 2010 · Comments (0)

Minneapolis, Min-iii-sooo-ta

   

Tags: , , ,
Posted in Blog, Pictures · April 6th, 2010 · Comments (0)

Change iPhone Carrier Name

Tags: , , ,
Posted in Hints, Software, Technical · March 3rd, 2010 · Comments (1)

First off, this hint will only work on iPhones that have been “jailbroken”. For more information on “jailbreaking” your iPhone, please visit the unofficial iPhone Dev Team’s Blog.

Check out “MakeItMine” app under Cydia. This application is a must for tweakers, as it changes your carrier name. Once the app is installed, and you have made the change, you can remove the app, and your custom setting remains.

Have fun!

Tags: , , ,
Posted in Hints, Software, Technical · March 3rd, 2010 · Comments (1)
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

Recent Posts

Categories

Blogroll

Pages

Archives

Tags

add-ons ads advertisement advertising Adware animations ant-virus Anti-Virus apple applications art artist awesome cellular chicken cluttered computers contact dialog dinner dock downloads environment fake firefox free Freeware google hint iphone News pdf Pictures Politics power screenshot Security Spyware system tools Tricks tweet twitter Windows workspace

What I'm Doing...