Skip to content

Instantly share code, notes, and snippets.

@jakebellacera
Created November 30, 2010 19:37
Show Gist options
  • Save jakebellacera/722244 to your computer and use it in GitHub Desktop.
Save jakebellacera/722244 to your computer and use it in GitHub Desktop.
<?php
// RFLX <img> resize
// server-side image resizing
function rflx_img_resize($src, $width, $height, $mu = true, $zoom = true) {
if ($zoom) {
if ($zoom == false) {
$z = 0;
} else {
$z = 1;
}
} else {
$z = 1;
}
if ($mu == true) {
echo bloginfo('template_directory') . '/rflx/helpers/timthumb/timthumb.php?src=' . mu_img_location($src) . '&w=' . $width . '&h=' . $height . '&zc=' . $z;
} else {
echo bloginfo('template_directory') . '/rflx/helpers/timthumb/timthumb.php?src=' . $src . '&w=' . $width . '&h=' . $height . '&zc=' . $z;
}
}
function mu_img_location($src, $post_id = null) {
if ($post_id == null) {
global $post;
$post_id = $post->ID;
}
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/', $src);
if (isset($imageParts[1])) {
$src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}
}
return $src;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment