imagecache_create_url

Versions
5
imagecache_create_url($presetname, $path)
6
imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE)

Return a URL that points to the location of a derivative of the original image transformed with the given preset.

Special care is taken to make this work with the possible combinations of Clean URLs and public/private downloads. For example, when Clean URLs are not available an URL with query should be returned, like http://example.com/?q=files/imagecache/foo.jpg, so that imagecache is able intercept the request for this file.

This code is very similar to the Drupal core function file_create_url(), but handles the case of Clean URLs and public downloads differently however.

Parameters

$presetname

$filepath String specifying the path to the image file.

$bypass_browser_cache A Boolean indicating that the URL for the image should be distinct so that the visitors browser will not be able to use a previously cached version. This is

▾ 10 functions call imagecache_create_url()

imagecache_ui_preset_form in contributions/imagecache/imagecache_ui.pages.inc
shadowbox_imagecache_create_url in contributions/shadowbox/shadowbox.module
Implementation of the imagecache_create_url() function for integration with imagecache module versions prior to imagecache 2.
shadowbox_imagecache_create_url in contributions/shadowbox/shadowbox.module
Implementation of the imagecache_create_url() function for integration with imagecache module versions prior to imagecache 2.
template_preprocess_galleria in contributions/galleria/galleria.module
Implementation of template_preprocess_hook().
theme_imagecache in contributions/imagecache/imagecache.module
Create and image tag for an imagecache derivative
theme_imagecache_formatter_url in contributions/imagecache/imagecache.module
theme_imagefield_image_imagecache_lightbox2 in contributions/lightbox2/lightbox2.formatter.inc
Generate the HTML output for imagefield + imagecache images so they can be opened in a lightbox by clicking on the image on the node page or in a view.
theme_imagefield_image_imagecache_thickbox in contributions/thickbox/thickbox.module
Implementation of theme_imagefield_image_imagecache_thickbox().
theme_uc_product_image in contributions/ubercart/uc_product/uc_product.module
Format a product's images with imagecache and Thickbox.
uc_product_get_picture in contributions/ubercart/uc_product/uc_product.module
Returns an HTML img tag based on a node's attached image.

Code

contributions/imagecache/imagecache.module, line 311

<?php
function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = FALSE) {
  $path = _imagecache_strip_file_directory($filepath);
  if (module_exists('transliteration')) {
    $path = transliteration_get($path);
  }

  $args = array('absolute' => TRUE, 'query' => empty($bypass_browser_cache) ? NULL : time());
  switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
    case FILE_DOWNLOADS_PUBLIC:
      return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);
    case FILE_DOWNLOADS_PRIVATE:
      return url('system/files/imagecache/'. $presetname .'/'. $path, $args);
  }
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.