If a badly formed string of resolutions is entered in the setup - e.g.
1400, 1024,878, 800,420 added spaces
or
1400,1024 878,800,420 missing comma

this causes problems as line 58 in adaptive_image.image.inc will take all characters ( including spaces ) between commas to form resolutions that make up the image URL
$derivative_uri = $path_parts['dirname'] . '/' . $resolution . '/' . $path_parts['basename'];

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

n1k’s picture

Status: Active » Needs review
FileSize
986 bytes

Hi,

This patch should validate the input and show an error message if some commas are missing.

sanduhrs’s picture

Priority: Major » Normal
Status: Needs review » Needs work
+++ b/adaptive_image.moduleundefined
@@ -142,6 +142,25 @@ function theme_adaptive_image_scale_summary($variables) {
+  $resolutions = $form['data']['resolutions']['#value'];
+  $resolutions = explode(',',$resolutions);

Can be combined into one line.
Adhere to the coding standards http://drupal.org/coding-standards#functcall

+++ b/adaptive_image.moduleundefined
@@ -142,6 +142,25 @@ function theme_adaptive_image_scale_summary($variables) {
+  foreach($resolutions as $r_width)

Please don't use abbreviations.

+++ b/adaptive_image.moduleundefined
@@ -142,6 +142,25 @@ function theme_adaptive_image_scale_summary($variables) {
+  foreach($resolutions as $r_width)
+  {

Adhere to the coding standards http://drupal.org/coding-standards#controlstruct

+++ b/adaptive_image.moduleundefined
@@ -142,6 +142,25 @@ function theme_adaptive_image_scale_summary($variables) {
+      form_set_error('Resolutions', t("Values have to be seperated by comma. For example: 1382, 992, 768, 480"));

The first parameter is the form elements name, so probably lower case.

All only minor things, please correct them for the patch to be committed.
Thanks.

n1k’s picture

Status: Needs work » Needs review
FileSize
2.14 KB

Adjusted patch to coding standards.

n1k’s picture

Fixed file.

n1k’s picture

And fixed it again.

sanduhrs’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Needs review » Fixed

Committed and pushed to 7.x-1.x.
Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.