<p>The imageDriver setting just determines <em>which</em> driver Craft should use when working with images (GD or ImageMagick) for things like image cleansing and image transforms. So changing its value will not affect whether images are cleansed on upload; just which driver would be used for that process.</p>

<p>If you want to <em>disable</em> image cleansing on the front end, you will need to write a plugin that handles the upload. You can find out how to do that from this answer: <a href="https://craftcms.stackexchange.com/a/9675/9">https://craftcms.stackexchange.com/a/9675/9</a></p>

CC BY-SA 3.0
2015-09-30T10:46:00.687Z
`null` would also disable it, right?
Souvik Das Gupta
CC BY-SA 3.0
2015-09-30T13:34:43.520Z
No; setting it to `null` will give you the same result as setting it to `'auto'` (Craft will use ImageMagick if it’s available; otherwise GD).
Brandon Kelly
CC BY-SA 3.0
2015-09-30T10:38:31.473Z
2015-09-30T10:38:31.473Z
2017-04-13T12:51:00.253Z
Brandon Kelly
<p>I can think of a few ways to go about this and probably the easiest one is to do something like this completely untested code from your <code>craft/config/general.php</code> file.</p>

<pre><code>return array(
    'imageDriver' =&gt; strpos($_SERVER['REQUEST_URI'], 'admin') !== false ? 'imagick' : 'gd',
);
</code></pre>

<p>Of course you'd change 'admin' to whatever your <a href="http://buildwithcraft.com/docs/config-settings#cpTrigger" rel="nofollow">cpTrigger</a> config setting is set to.</p>

<p>I'd also be extremely curious to know what the reasoning for this was, too. :)</p>

<p>Alternatively, if you wanted to do this from a Craft plugin, then you could add an <code>init()</code> method to your base plugin file and do something like this:</p>

<pre><code>public function init()
{
    if (craft()-&gt;request-&gt;isCpRequest())
    {
        craft()-&gt;config-&gt;set('imageDriver', 'imagick');
    }
    else
    {
        craft()-&gt;config-&gt;set('imageDriver', 'gd');
    }

    parent::init();
}
</code></pre>

CC BY-SA 3.0
2015-09-30T06:24:45.220Z
The form is being handled by a custom plugin action. Can the config be overridden temporarily inside the action?
Souvik Das Gupta
CC BY-SA 3.0
2015-09-30T06:33:36.750Z
Updated answer.
Brad Bell
CC BY-SA 3.0
2015-09-30T06:37:00.770Z
Thanks. Doing this because we want the public uploads to remain in raw state — no manipulations / transformations.
Souvik Das Gupta
CC BY-SA 3.0
2015-09-30T06:44:15.027Z
FWIW, Craft is going to re-save all uploaded images to strip them of any potentially malicious embedded code regardless of the image library installed on the server.
Brad Bell
CC BY-SA 3.0
2015-09-30T06:10:17.183Z
2015-09-30T06:33:27.817Z
2015-09-30T06:33:27.817Z
Brad Bell
<p>We want the public uploads to remain in raw state. Is it possible to disable image cleansing for entries created through public facing form? (Image cleansing to continue working for uploads through Control Panel.)</p>

<plugin-development><form><image-transforms>
Disable image cleansing for public facing form uploads
# Disable image cleansing for public facing form uploads

(Asked by: username_0 on 2015-09-30)

We want the public uploads to remain in raw state. Is it possible to disable image cleansing for entries created through public facing form? (Image cleansing to continue working for uploads through Control Panel.)

**Tags:** plugin-development, form, image-transforms

---

## 2 answers

### Answer by username_1 on 2015-09-30. Score: 1

The imageDriver setting just determines *which* driver Craft should use when working with images (GD or ImageMagick) for things like image cleansing and image transforms. So changing its value will not affect whether images are cleansed on upload; just which driver would be used for that process.

If you want to *disable* image cleansing on the front end, you will need to write a plugin that handles the upload. You can find out how to do that from this answer: <https://craftcms.stackexchange.com/a/9675/9>

> **Comments:**
> **username_0**: `null` would also disable it, right?  
> **username_1**: No; setting it to `null` will give you the same result as setting it to `'auto'` (Craft will use ImageMagick if it’s available; otherwise GD).  

---

### Answer by username_2 on 2015-09-30. Score: 0

I can think of a few ways to go about this and probably the easiest one is to do something like this completely untested code from your craft/config/general.php file.
return array(
    'imageDriver' => strpos($_SERVER['REQUEST_URI'], 'admin') !== false ? 'imagick' : 'gd',
);

Of course you'd change 'admin' to whatever your cpTrigger config setting is set to.
I'd also be extremely curious to know what the reasoning for this was, too. :)
Alternatively, if you wanted to do this from a Craft plugin, then you could add an init() method to your base plugin file and do something like this:
public function init()
{
    if (craft()->request->isCpRequest())
    {
        craft()->config->set('imageDriver', 'imagick');
    }
    else
    {
        craft()->config->set('imageDriver', 'gd');
    }

    parent::init();
}

> **Comments:**
> **username_0**: The form is being handled by a custom plugin action. Can the config be overridden temporarily inside the action?  
> **username_2**: Updated answer.  
> **username_0**: Thanks. Doing this because we want the public uploads to remain in raw state — no manipulations / transformations.  
> **username_2**: FWIW, Craft is going to re-save all uploaded images to strip them of any potentially malicious embedded code regardless of the image library installed on the server.  

---

