Hi,

I have tried to add resizing on the client side by adding the resize parameter but it doesn't seem to work with me.

I have added the following code in function plup_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
$resizing=new stdClass();
$resizing->width='800';
$resizing->height='800';
$resizing->quality='90';
$images['#plup_override']['resize'] = array($resizing);

and added the resize variable in function plup_element_info() .

However, I keep receiving Error: Only JPEG, PNG and GIF images are allowed when uploading an image with a size exceeding the width or height specified.

Do you know how can I get over this error?

Thanks

Comments

Anonymous’s picture

drupalpal’s picture

Am I doing the resizing in the correct way? I am quiet sure that the file is an image....

Anonymous’s picture

Category: bug » support
Anonymous’s picture

Status: Active » Closed (works as designed)

You can't resize on client side other than with javascript.

drupalpal’s picture

Status: Closed (works as designed) » Active

But how can I take advantage of resize option in plupload then http://plupload.com/documentation.php ?

Anonymous’s picture

Status: Active » Closed (works as designed)

a) Change your field's settings.
b) The option to alter Plupload javascript settings is available only if you are using plupload form element in you custom module's form OR by altering the form element's settings through the hook_form_alter hook. The documentation for developers on using the plup form element isn't available right now but It's on a roadmap for 1.0(stable version of the module). For now you can see the structure of the form element in the plup_element_info() function and how it's actually done in plup_field_widget_form().

jglynn’s picture

The way to get plup module to resize on clientside is you need to set multipart to TRUE. Then setting the resize parameters will work. At least using HTML5, that's what I've tested so far.

netturbina’s picture

Can you tell more details about how to programm this?

Anonymous’s picture

Issue summary: View changes

a) You should not edit the module directly. Use hook_form_alter instead
b) Try to remove the quotation marks around the numbers so integers are provided and not strings.

netturbina’s picture

This code works for me:
$images['#plup_override']['resize'] = (object) array('width' =>767, 'height' => 576, 'quality' => 90, 'crop' => true);
for plupload library ver. 2.1.1 too.
but I must have crop, not resize and crop.
I have always the same parameters in my website - big images (2-5MB) must be cropped to 767x576px... in the center horizontaly and in the middle vertically, please help me, I can pay.

cthshabel’s picture

it seems this issue may be similar for the FileField Pllupload module as well: https://www.drupal.org/node/2080945

Does this really require pluploud library above 2.x.x??? If so, the Plupload module does not support anything over 1.5.8, so how are we getting this working?