/** * Get file URL. * * @uses WPCF_Path (functions taken from CRED_Loader) * @param type $file * @return type */ function wpcf_get_file_url($file, $use_baseurl = true) { WPCF_Loader::loadClass('path'); return WPCF_Path::getFileUrl($file, $use_baseurl); }
public static function getImgObject($img, $width, $height, $type, $mime) { if ($cached = self::$__cache->getCache("imgobj_{$img}")) { return $cached; } if (self::inUploadAbsPath($img)) { $url = self::normalizeAttachmentUrl($img); } else { WPCF_Loader::loadClass('path'); $url = WPCF_Path::getFileUrl($img, false) . '/' . basename($img); } $data = array('width' => $width, 'height' => $height, 'imagetype' => $type, 'mime' => $mime, 'url' => $url, 'path' => $img, 'pathinfo' => pathinfo($img)); $imgData = new Types_Image_Model((object) $data); return self::$__cache->setCache("imgobj_{$img}", $imgData->getImg()); }