1

I am building a site using Drupal 7, in which users can upload content in a form, also images. The images will be uploaded and stored with the Media module version 7.x-2.x-dev.

I want to allow users to upload any image up to 10 MB of size.

But, I don't want to have many pictures as big as 10 MB on my server. I prefer to save the image only after it has been resized to 800x600 to have more space on my server.

How can I achieve this with the Media module?

In addition, what is the difference between the field type "file" to "image" when rendering images with the Media module?

There is an option to chose "Field Type: File" and "Widget Type: Media Browser", and then chose rendered file, and then image on the Media settings (here is a great guide to the Media module). Another option is to chose "Field Type: image" and "Widget Type: Media Browser".

3 Answers 3

0

First off, image dimensions are not the same as image sizes. Images could have the dimensions of 800x600 but still exceed 10 MB in size.

One possible solution is to create new image styles under /admin/config/media/image-styles/ providing your desired dimensions (e.g. 800x600). See attached image:

enter image description here

Then under the Manager Displays section of the Content Type containing the image field, choose the Image style you just created. See attached image:

enter image description here

Then set the Maximum upload size for your field in the Manage Fields section of the Content Type containing the image field. See attached image:

enter image description here

1
  • I thank you for the answer :) My question is regarding an image field with the media module. I saw that I can use "Field Type: File" and "Widget Type: Media Browser". In this case, I can't do as you wrote. Only if I will use "Field Type: image" and "Widget Type: Media Browser" and then chose rendered file, and then image on the media settings I can do as you wrote. What is the difference between the Field type file to image, when it comes to the media module? Maybe this link can help explain what I mean: drupal.org/node/1699054
    – EB84
    Commented Mar 19, 2014 at 13:34
0

To crop images before saving them, you can use these modules on your drupal website:

  1. Manual Crop
  2. Imagefield Crop

There are some other modules as well, you can find of a list of image crop modules and comparison among there features from link below:

Image crop modules comparison

0

To resize on saving, use max-image-size module, from module page:

Simply enable the module and it will begin resizing images when they are uploaded. It will scan for images above the configured dimensions once a day and queue them to be resized.

This is different from the core image field size restrictions in that it will work on already uploaded files and imported content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.