Commit cefd354bde6691cc851781f7713b9563348a22b7

Authored by charlmert
1 parent 0cd525ef

Brand server without requiring access to FS

PT: 1243391

Fixed: - Image crop page only appears if the image needs to be cropped otherwise user is taken straight to the apply page.

Updated by: Charl Joseph Mert
plugins/ktcore/admin/manageBranding.php
... ... @@ -407,7 +407,9 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
407 407  
408 408 switch ($resizeMethod) {
409 409 case 'crop':
410   - if ($this->isImageCroppable($logoFile, $this->maxLogoWith, $this->maxLogoHeight)) {
  410 +
  411 + if ($this->isImageCroppable($logoFile, $this->maxLogoWith, $this->maxLogoHeight, $type)) {
  412 +
411 413 $retForm = $this->getCropLogoForm($logoFileName);
412 414 } else {
413 415 $_SESSION['KTErrorMessage'][] = _kt("The image was too small to be cropped.");
... ... @@ -417,8 +419,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
417 419 return $retForm->render();
418 420  
419 421 case 'scale':
420   - $type = $_FILES['_kt_attempt_unique_file']['type'];
421   -
  422 +
422 423 $logoFileNameStretched = 'logo_tmp_stretched_'.md5(Date('ymd-hms')).'.'.$ext; //Fighting the browser cache here
423 424 $logoFileStretched = $logoDir.DIRECTORY_SEPARATOR.$logoFileNameStretched;
424 425  
... ... @@ -675,7 +676,7 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
675 676 * - Supported images are jpeg, png and gif
676 677 *
677 678 */
678   - public function isImageCroppable( $origFile, $width, $height) {
  679 + public function isImageCroppable( $origFile, $width, $height, $type) {
679 680 global $default;
680 681  
681 682 //Requires the GD library if not exit gracefully
... ... @@ -709,7 +710,10 @@ class ManageBrandDispatcher extends KTAdminDispatcher {
709 710 */
710 711 $orig_x = imagesx($orig);
711 712 $orig_y = imagesy($orig);
712   -
  713 +
  714 + $default->log->info("ORIG_X : $orig_x");
  715 + $default->log->info("ORIG_Y : $orig_y");
  716 +
713 717 if (($orig_x > $width) || ($orig_y > $height)) {
714 718 return true;
715 719 }
... ...