_upload_image

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

modules/upload/upload.module, строка 858

Версии
5
_upload_image($file)

Check an upload, if it is an image, make sure it fits within the maximum dimensions allowed.

▾ 1 функция вызывает _upload_image()

_upload_prepare in modules/upload/upload.module
Save new uploads and attach them to the node object. append file_previews to the node object as well.

Код

<?php
function _upload_image($file) {
  $info = image_get_info($file->filepath);

  if ($info) {
    list($width, $height) = explode('x', variable_get('upload_max_resolution', 0));
    if ($width && $height) {
      $result = image_scale($file->filepath, $file->filepath, $width, $height);
      if ($result) {
        clearstatcache();
        $file->filesize = filesize($file->filepath);
        drupal_set_message(t('The image was resized to fit within the maximum allowed resolution of %resolution pixels.', array('%resolution' => variable_get('upload_max_resolution', 0))));
      }
    }
  }

  return $file;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему