Question: I have a view (filtering on content) that is returning duplicates. I am trying to used hook\_view\_prerender to remove those duplicates... but even after running this, I still get duplicates... Any ideas? Here's my function (and yes I know the function is running):

`function customedm_views_pre_render(&$view) {
 $used_nids = array();
 if ($view->name == 'new_resources'){
 echo ('hi');
 foreach ($view->result as $row){
 if (!in_array($row->nid, $used_nids)) {
 $new_view_result[] = $row;
 $used_nids[] = $row->nid;
 }
 }
 $view->result = $new_view_result;
 }
 }`

Answer: 
You don't want to return the message "your image is too big" as people nowadays are uploading directly from their mobile phones and do not have (or know) a way of resizing/cropping themselves before uploading.

So you should try it via another way: do not impose restrictions on the original image, but use an image style to display the uploaded images and add some smart/user/custom crop effect to that image style. There are a number of modules that let users/editors custom crop images, e.g:

* [Imagefield crop](https://www.drupal.org/project/imagefield_crop)
* [Manual Crop](https://www.drupal.org/project/manualcrop)
* [Smart Crop](https://www.drupal.org/project/smartcrop)
* ...

Also see [Comparison of image cropping and resizing modules](https://www.drupal.org/node/1179172).
You need to go to manage fields and click edit on your image field.

you should see Maximum image resolution and Minimum image resolution. Try setting both of these fields to 500x500

**Note:** if you are using the default Drupal user pictures in admin/config/people/accounts you would have to turn them off, since you can't give them a max/min resolution. Then just add an image field in admin/config/people/accounts/fields and use that as user pictures.