diff --git a/opengraph_meta.admin.inc b/opengraph_meta.admin.inc index 286bdf9..b32bcea 100644 --- a/opengraph_meta.admin.inc +++ b/opengraph_meta.admin.inc @@ -39,6 +39,13 @@ function opengraph_meta_settings_form() { '#description' => t('Absolute or site-relative URL to an image to use for the %tag tag for nodes which don\'t have their own images.',array('%tag' => 'og:image')), '#default_value' => variable_get(OPENGRAPH_META_VAR_FALLBACK_IMG, ''), ); + $form['defaults'][OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT] = array( + '#title' => t('Default image style'), + '#type' => 'select', + '#options' => image_style_options(FALSE), + '#description' => t('Select a default image style for the %tag tag.',array('%tag' => 'og:image')), + '#default_value' => variable_get(OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT, ''), + ); $form['defaults']['types'] = array( '#type' => 'fieldset', '#title' => t('Mapping content type to meta type'), @@ -145,6 +152,7 @@ function opengraph_meta_settings_form_submit($form, &$form_state) { // save other vars variable_set(OPENGRAPH_META_VAR_SITE_NAME, $values[OPENGRAPH_META_VAR_SITE_NAME]); variable_set(OPENGRAPH_META_VAR_FALLBACK_IMG, $values[OPENGRAPH_META_VAR_FALLBACK_IMG]); + variable_set(OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT, $values[OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT]); // save optional tags $options = array(); diff --git a/opengraph_meta.common.inc b/opengraph_meta.common.inc index 491e401..ac29ad3 100644 --- a/opengraph_meta.common.inc +++ b/opengraph_meta.common.inc @@ -10,6 +10,7 @@ define('OPENGRAPH_META_VAR_CONTENT_TYPE_', 'opengraph_meta_type_'); define('OPENGRAPH_META_VAR_CONTENT_TYPE_CCK_', 'opengraph_meta_cck_'); define('OPENGRAPH_META_VAR_SITE_NAME', 'opengraph_meta_site_name'); define('OPENGRAPH_META_VAR_FALLBACK_IMG', 'opengraph_meta_fallback_img'); +define('OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT', 'opengraph_meta_image_style_default'); define('OPENGRAPH_META_VAR_OPTIONAL_TAGS', 'opengraph_meta_optional_tags'); @@ -555,7 +556,7 @@ class OpenGraphMetaDrupalLayer { if (!empty($fields['filemime']) && FALSE !== stripos($fields['filemime'], 'image') && !empty($fields[$_uri_field])) { $url = $fields[$_uri_field]; if (7 <= OPENGRAPH_META_DRUPAL_VERSION) - $url = image_style_url('thumbnail', $fields[$_uri_field]); + $url = image_style_url(variable_get(OPENGRAPH_META_VAR_IMAGE_STYLE_DEFAULT, 'thumbnail'), $fields[$_uri_field]); array_push($resultarray, array( 'title' => !empty($fields['title']) ? $fields['title'] : $url,