You are here

function google_qr_code_max_total_px in Google QR Code Generator 7

Custom Form validation for a maximum dimension size of 300,000 pixels.

1 string reference to 'google_qr_code_max_total_px'
google_qr_code_admin_settings_form in ./google_qr_code.module
Creation of admin settings form for callback.

File

./google_qr_code.module, line 158
Provides block using Google Charts to render QR code.

Code

function google_qr_code_max_total_px($form, &$form_state) {
  $qr_width = $form_state['values']['google_qr_code_width'];
  $qr_height = $form_state['values']['google_qr_code_height'];
  $total_pixels = $qr_width * $qr_height;
  if (is_numeric($total_pixels) && $total_pixels > 300000) {
    $error_text = t('Total dimensions cannot exceed 300,000px. Currently at @total', array(
      '@total' => $total_pixels,
    ));
    form_set_error('google_qr_code_image_settings', t($error_text));
  }
}