Commit a5afb52e authored by Martin Postma's avatar Martin Postma
Browse files

Issue #2258147 by lolandese: Allows setting a minimum image width to force or...

Issue #2258147 by lolandese: Allows setting a minimum image width to force or suppress both title or metadata in the photo caption per block or album in the node body.
parent c585631e
Loading
Loading
Loading
Loading
+2 −3
Changes for block/flickr_block.install: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -10,9 +10,8 @@
function flickr_block_uninstall() {
  variable_del("flickr_block_refresh_random");
  variable_del("flickr_block_refresh_others");
  variable_del('flickr_counter');
  variable_del('flickr_maps');
  foreach (range(0, 11) as $delta) {
  variable_del('flickr_block_heading');
  foreach (range(0, 12) as $delta) {
    variable_del("flickr_block_{$delta}");
  }
}
+134 −163

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Changes for filter/flickr_filter.install: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -8,5 +8,5 @@
 * Implements hook_uninstall().
 */
function flickr_filter_uninstall() {
  variable_del('flickr_default_size');
  variable_del('flickr_filter_heading');
}
+14 −3
Changes for filter/flickr_filter.module: 14 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -69,13 +69,18 @@ Parameters:<br />
<strong>num=4</strong> : Display 4 photos. Default: num=@default_number (!config).<br />
<strong>media=all</strong> : Display both photos and videos. Default: media=photos<br />
<strong>tags=kids/men</strong> : Display all set, group or user photos that contain the indicated tags. Case insensitive, matches any tag, for photosets even partial. Multiple tags for groups will only query the last 500 photos on Flickr. Note that Flickr removes any whitespace from tags (e.g. 'Victoria park' becomes 'victoriapark'). Multiple tags should be seperated by a slash (/).<br />
<strong>heading=h2</strong> : Wraps the album title in HTML tags. Use p to apply no style or none to suppress the title. Default heading=p<br />
<strong>heading=h3</strong> : Wraps the album title in HTML tags. Use p to apply no style or none to suppress the title. Default heading=@default_count (!config).<br />
<strong>random=false</strong> : Display the newest photos first (reverse cronological order). Default: random=false<br />
<strong>count=false</strong> : Suppress display of the counter under the album (e.g. 5 out of 124 on Flickr). Default: count=@default_count (!config).<br />
<strong>mintitle=999</strong> : Suppress display of the title in the photo captions for images below a width of 999 px. Default: mintitle=@default_mintitle (!config).<br />
<strong>minmetadata=999</strong> : Suppress display of the metadata in the photo captions for images below a width of 999 px. Default: minmetadata=@default_minmetadata (!config).<br />
Ommiting parameters the default values will be used.", array(
    '!find_id' => $idgettr,
    '@default_size' => variable_get('flickr_default_size', 'm'),
    '@default_number' => variable_get('flickr_photos_per_page', 20),
    '@default_mintitle' => variable_get('flickr_title_suppress_on_small', '100'),
    '@default_minmetadata' => variable_get('flickr_metadata_suppress_on_small', '150'),
    '@default_heading' => variable_get('flickr_filter_heading', 'p'),
    '@default_count' => $count,
    '!config' => $config,
  ));
@@ -177,7 +182,7 @@ function flickr_filter_callback_album($matches) {
      $config['random'] = 'false';
    }
    if (!isset($config['heading'])) {
      $config['heading'] = 'p';
      $config['heading'] = variable_get('flickr_filter_heading', 'p');
    }
    if (!isset($config['tags'])) {
      $config['tags'] = '';
@@ -188,13 +193,19 @@ function flickr_filter_callback_album($matches) {
    if (!isset($config['count'])) {
      $config['count'] = variable_get('flickr_counter', 1) ? 'true' : 'false';
    }
    if (!isset($config['mintitle'])) {
      $config['mintitle'] = variable_get('flickr_title_suppress_on_small', '100');
    }
    if (!isset($config['minmetadata'])) {
      $config['minmetadata'] = variable_get('flickr_metadata_suppress_on_small', '150');
    }
    // Choose between 'recent' or 'random' based on 'random' parameter.
    // Note that we abuse the $delta parameter pass the random value to override
    // the default of the counter display.
    $config['random'] = $config['random'] == 'true' ? 1 : 0;
    $type = flickr_get_id_type($config['id']);
    $config['id'] = $type == 'user' ? flickr_user_find_by_identifier($config['id']) : $config['id'];
    $output = _flickr_album($type, $config['id'], $config['num'], $config['size'], $config['media'], $config['tags'], $config['count'], $config['random'], $config['heading']);
    $output = _flickr_album($type, $config['id'], $config['num'], $config['size'], $config['media'], $config['tags'], $config['count'], $config['random'], $config['heading'], $config['mintitle'], $config['minmetadata']);
    return $output;
  }
  return '';
+55 −39
Changes for flickr.admin.inc: 55 added lines, 39 removed lines.
Original line number Diff line number Diff line
@@ -69,25 +69,6 @@ function flickr_admin_settings() {
    '#size' => 3,
    '#maxlength' => 3,
  );
  if (module_exists('flickr_filter')) {
    $form['flickr_default_size'] = array(
      '#type' => 'select',
      '#title' => t('Default size'),
      '#default_value' => variable_get('flickr_default_size', 'm'),
      '#options' => array(
        's' => t('s: 75 px square'),
        't' => t('t: 100 px on longest side'),
        'q' => t('q: 150 px square'),
        'm' => t('m: 240 px on longest side'),
        'n' => t('n: 320 px on longest side (!)'),
        '-' => t('-: 500 px on longest side'),
        'z' => t('z: 640 px on longest side'),
        'c' => t('c: 800 px on longest side (!)'),
        'b' => t('b: 1024 px on longest side'),
      ),
      '#description' => t('A default Flickr size to use if no size is specified, for example [flickr-photo:id=3711935987].<br />After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.<br />!: TAKE CARE, n (320px) and c (800px) sizes are missing on many "older" Flickr images!'),
    );
  }
  $style_doc = l(t('Flickr module Style Guide'), 'https://drupal.org/node/2174131', array(
      'attributes' => array(
        'title' => t('Flickr Style Guide documentation | Drupal.org'),
@@ -175,37 +156,39 @@ function flickr_admin_settings() {
    '#default_value' => variable_get('flickr_counter', 1),
    '#description' => t('Shows how many photos are displayed out of the total number available for a user, group or set on Flickr. Can be overridden by the filter tag, eg. [flickr-photoset:id=72157634563269642,count=false]'),
  );
  $form['overlay_settings'] = array(
  if (module_exists('flickr_filter')) {
    $form['filter_settings'] = array(
      '#type' => 'fieldset',
    '#title' => t('Overlay browser settings'),
    '#description' => t('Leave empty to link directly to the Flickr photo page instead of opening the bigger version of the image.'),
  );
  $form['overlay_settings']['flickr_class'] = array(
    '#type' => 'textfield',
    '#title' => t('class'),
    '#default_value' => variable_get('flickr_class', ''),
    '#description' => t('For example: <em>colorbox</em>. After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.'),
      '#title' => t('Filter settings'),
      '#description' => t('After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.'),
    );
  $form['overlay_settings']['flickr_rel'] = array(
    $form['filter_settings']['flickr_filter_heading'] = array(
      '#type' => 'textfield',
    '#title' => t('rel'),
    '#default_value' => variable_get('flickr_rel', ''),
    '#description' => t('For example: <em>gallery-all</em> or <em>lightbox[gallery]</em>. After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.'),
      '#title' => t('Wrap the album title in an HTML heading tag (only for the text filter)'),
      '#required' => TRUE,
      '#default_value' => variable_get('flickr_filter_heading', 'p'),
      '#description' => t("Use 'p' for no style, 'h3' for a heading or 'none' to not display a title."),
      '#size' => 4,
      '#maxlength' => 4,
    );
  $form['overlay_settings']['flickr_opening_size'] = array(
    $form['filter_settings']['flickr_default_size'] = array(
      '#type' => 'select',
    '#title' => t('Image size to open'),
    '#default_value' => variable_get('flickr_opening_size', ''),
      '#title' => t('Default size'),
      '#default_value' => variable_get('flickr_default_size', 'm'),
      '#options' => array(
        's' => t('s: 75 px square'),
        't' => t('t: 100 px on longest side'),
        'q' => t('q: 150 px square'),
        'm' => t('m: 240 px on longest side'),
        'n' => t('n: 320 px on longest side (!)'),
      '' => t('-: 500 px on longest side'),
        '-' => t('-: 500 px on longest side'),
        'z' => t('z: 640 px on longest side'),
        'c' => t('c: 800 px on longest side (!)'),
        'b' => t('b: 1024 px on longest side'),
      ),
    '#description' => t('The image size to open in the overlay browser when clicking the image. Larger sizes make navigating to next and previous pictures slower.<br />After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.<br />!: TAKE CARE, n (320px) and c (800px) sizes are missing on many "older" Flickr images!'),
      '#description' => t('A default Flickr size to use if no size is specified, for example [flickr-photo:id=3711935987].<br />After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.<br />!: TAKE CARE, n (320px) and c (800px) sizes are missing on many "older" Flickr images!'),
    );
  }
  if (module_exists('flickr_block')) {
    $form['block_settings'] = array(
      '#type' => 'fieldset',
@@ -214,10 +197,10 @@ function flickr_admin_settings() {
    );
    $form['block_settings']['flickr_block_heading'] = array(
      '#type' => 'textfield',
    '#title' => t('Wrap the album title in HTML heading tag (only for blocks)'),
      '#title' => t('Wrap the album title in an HTML heading tag (only for blocks)'),
      '#required' => TRUE,
      '#default_value' => variable_get('flickr_block_heading', 'h2'),
    '#description' => t("Default: 'h2'. Use 'p' for no style or 'none' to not display a title."),
      '#description' => t("Use 'p' for no style, 'h2' for a heading or 'none' to not display a title."),
      '#size' => 4,
      '#maxlength' => 4,
    );
@@ -241,6 +224,39 @@ function flickr_admin_settings() {
      '#maxlength' => 3,
    );
  }
  $form['overlay_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Overlay browser settings'),
    '#description' => t('Leave empty to link directly to the Flickr photo page instead of opening the bigger version of the image.'),
  );
  $form['overlay_settings']['flickr_class'] = array(
    '#type' => 'textfield',
    '#title' => t('class'),
    '#default_value' => variable_get('flickr_class', ''),
    '#description' => t('For example: <em>colorbox</em>. After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.'),
  );
  $form['overlay_settings']['flickr_rel'] = array(
    '#type' => 'textfield',
    '#title' => t('rel'),
    '#default_value' => variable_get('flickr_rel', ''),
    '#description' => t('For example: <em>gallery-all</em> or <em>lightbox[gallery]</em>. After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.'),
  );
  $form['overlay_settings']['flickr_opening_size'] = array(
    '#type' => 'select',
    '#title' => t('Image size to open'),
    '#default_value' => variable_get('flickr_opening_size', ''),
    '#options' => array(
      'q' => t('q: 150 px square'),
      'm' => t('m: 240 px on longest side'),
      'n' => t('n: 320 px on longest side (!)'),
      '' => t('-: 500 px on longest side'),
      'z' => t('z: 640 px on longest side'),
      'c' => t('c: 800 px on longest side (!)'),
      'b' => t('b: 1024 px on longest side'),
      'h' => t('h: 1600 px on longest side'),
    ),
    '#description' => t('The image size to open in the overlay browser when clicking the image. Larger sizes make navigating to next and previous pictures slower.<br />After saving the configuration <a href="?q=admin/config/development/performance">clear the cache</a>.<br />!: TAKE CARE, n (320px) and c (800px) sizes are missing on many "older" Flickr images!'),
  );
  // We need an api key before we can verify usernames.
  if (!$form['flickr_api_key']['#default_value']) {
    $form['flickr_default_userid']['#disabled'] = TRUE;
Loading