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 . "\""); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . @filesize($tmpFilenamePath)); if (function_exists('set_time_limit')) {
/* // Testing echo 'path: '.$path.'<br>'; echo 'quality: '.$quality.'<br>'; echo 'crop: '.$crop.'<br>'; echo 'hcrop: '.$hcrop.'<br>'; echo 'sharpen: '.$sharpen.'<br>'; echo 'watermark: '.$watermark.'<br>'; exit; */ $mediaImage = new imagetools($path); $mediaImage->setQuality($quality); $mediaImage->setCrop($crop); $mediaImage->setDebugMode($_SESSION['debugMode'], $plstart); $mediaImage->setHCrop($hcrop); $mediaImage->setSize($size); $mediaImage->setSharpen($sharpen); $mediaImage->setWatermark($watermark); if ($_SESSION['debugMode'] or $config['cacheImages'] == 0 or $offSiteRequest) { $mediaImage->createImage(1, ''); } else { $mediaImage->createImage(1, $cachePathFile); } // Cache //file_get_contents xxxxxxxxxx for reading cached file } catch (Exception $e) { die($e->getMessage()); } if ($db) { mysqli_close($db); } // Close any database connections