die('File download failed!'); } } else { die("File cannot be found at link provided."); } } else { // Do resizing and downloading $imgPath = "{$folderPath}/originals/{$mediaInfo[filename]}"; } try { $mediaImage = new imagetools($imgPath); $mediaImage->setQuality(100); //$mediaImage->setCrop($crop); //$mediaImage->setHCrop($hcrop); $mediaImage->setSize($width); $mediaImage->setWidth($width); $mediaImage->setHeight($height); //$mediaImage->setSharpen($sharpen); $mediaImage->setWatermark($digital['watermark']); $mediaImage->createImage(0, $tmpFilenamePath); } catch (Exception $e) { die(exceptionError($e)); } //$file = "./assets/tmp/{$tmpFilename}"; $ctype = "application/txt"; if (!file_exists($tmpFilenamePath)) { die("Error 3: This file cannot be found on the server."); } $downloadFilename = basefilename($mediaInfo['ofilename']) . ".jpg"; header("Content-Type: {$ctype}"); header("Content-Disposition: attachment; filename=\"" . $downloadFilename . "\"");