WordPress Imagick in different folder then images

I have a working Imagick function, but for some reason the file keeps getting changed to .bak (despite changing file permissions n stuff). So we need to place the file somewhere else.

I placed the .php file a couple folders higher then it was and adjusted the links appropriately but I’m just getting Internal Server Errors. If I place it back in the same folder as the images it works again. Am I doing anything wrong? A solution for the .bak stuff is also appreciated (if you have that answer but don’t know why this is failing.)

.php file path is = wp-content/uploads/pluginName/file
image file path is = wp-content/uploads/pluginName/path/to/image/

if(isset($_POST['file_name'])) {
    $fromDir = '/path/to/image/' . $_POST['file_name'] . '.pdf[0]';
    $toDir = '/path/to/image/' . $_POST['file_name'] . '.jpg';
    // Create Imagick class
    $image = new Imagick();
    // Set resolution of file
    $image->setResolution(216, 216);
    // Set image to change
    // Create jpg from pdf.

} else { 

Read more here: WordPress Imagick in different folder then images

Leave a Reply

Your email address will not be published. Required fields are marked *