Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/pre link image

An example function based on this filter hook that regulates the size of the images, based on you having phpThumb. (http://phpthumb.sourceforge.net - phpThumb is a free library you can download and install on your php webserver. Installation and configuring phpThumb is beyond scope of this, sorry).

function pre_link_image_add_thumb($img_url){
	// set our width value
	$width = 400;

        // set a height value? update it in the params line below add "&h=$height". we only are using width though.
        // $height = 80;
	// this points to our specific location for phpThumb
	$thumb_file = "http://yourserver.com/phpThumb/phpThumb.php";
	// here we specify a width and the img src recvd by this function
	$thumb_params = "w=$width&src=$img_url";
	// and now we make our "new" img url
	$new_img_url = $thumb_file . "?" . $thumb_params;
	// and now we return it!
	return $new_img_url;	

Basically, you can do stuff with/to the img_url entered by the user when they add/edit a link. this info is then written to the database, and now is what the user sees when going back to edit that link. The other end of this would be a "post_link_image" function, but i don't believe the hooks exist yet on that side.

Return to Plugin API/Filter Reference