Closed (won't fix)
Project:
IMCE
Version:
6.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
1 Jul 2008 at 16:34 UTC
Updated:
3 Aug 2012 at 15:21 UTC
Is it possible to achieve this? Users cannot control whether or not to create thumbnails. These images are automatically created.
Comments
Comment #1
grodt commentedAfter one year maybe there is a solution now. I looked for it but i could not find a solution. So i m asking the same question: Is it possible to force thumbnail creation?
Comment #2
ufku commentedYou may have a look at http://drupal.org/node/366884#comment-1308566
Adding .hide() after .click() will hide the check box, which prevents unchecking it.
Comment #3
rschwab commentedThis works great for the first image uploaded but not for subsequent uploads. Is there a way to keep that checkbox clicked for every upload?
I'm thinking I need to use hook_form_alter to add an onSubmit attribute to the upload form, then name the click&hide function and call it when the form submits? Am I on the right track?
- Ryan
Edit: No, this won't work because it shows the checkbox until its submitted, meaning if someone clicks to make the thumbnail it ends up unclicking before submission. And the interface is back which I wanted hidden anyway.
I think I will try using hook_form_alter to change the checkbox to default to true.
Comment #4
rschwab commentedSolved! (mostly)
The solution is to split the .click() and .hide() parts of your javascript.
At the bottom of your imce-content.tpl.php put:
Where Thumb is your thumbnail name. For example if you named it 'small' it would look like $('#edit-thumbnails-small').hide();
Ok great, now the option to create or not create thumbnails is entirely in your hands. Now to make thumbnail creation automatic. Again on imce-content.tpl.php, you put this code after the IE6 styles and before the
<noscript>tag:My function name is a legacy of my experimenting, but you get the idea. Its a js to click your thumbnail creation checkbox before its passed to the submit function. Awesome, now we just need to make sure that this script is called when the submit button is clicked. So in a custom module you need to add this:
This code will hide the "Create Thumbnails" text and add the onSubmit attribute to the form root. The only remaining issue is the checkbox text is left over. Even using String overrides I haven't been able to remove them. I guess that text isn't passed through t(). If anyone has a creative solution to that final remaining issue, I would very much like to hear from you :)
Good luck!
- Ryan
Comment #5
dooug commentedIMCE 6.x-1.2
I did this to check the thumbnail option by default. However, this fix should probably be replaced by a better feature to handle default thumbnail options? Has this been improved/fixed on 6.x-1.3 or the dev version? Or is there any work being done in this direction?
Comment #6
mshepherd commentedI just edited the page.inc file to include a #default_value in the imce_upload_form function. While this is specific to my thumbnail presets (Small, Medium and Large), you should be able to change it to suit your thumbnails easily. And it shouldn't be too difficult to generalize this. I'll do it if I get a chance.
By the way, this does not force thumbnail creation for each image, merely ticks all the boxes by default - they can still be unticked.
Comment #7
viil commentedsubscribing - I would find this functionality very useful :)
Comment #8
ufku commentedClosing 6.x-1.x issues as this branch is no more supported.
Comment #9
rschwab commentedMaybe this can go in 6.x-2.x?
Comment #10
ufku commentedYou can alter any checkbox in any form in theme layer or by a custom module. It can also be done using javascript.
Comment #11
arnoldbird commentedNo need for javascript. Here's how it's done. In any hook_form_alter function:
In your CSS:
That will check all your thumbnail boxes, no matter what the options are, and will hide all the checkboxes.