Skip to content

Commit

Permalink
Merge pull request #9 from timgatzky/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
timgatzky committed Dec 14, 2017
2 parents 4ca07f5 + c893c2f commit 570d92f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions system/modules/pct_image_crop/PCT/ImageCrop/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public function getContentElementCallback($objRow,$strBuffer,$objElement)
$intId = $objElement->cteAlias;
}

if($objElement->type == 'text' && !$objElement->addImage)
{
return $strBuffer;
}

$strField = 'pct_image_crop_data';
$arrFieldDef = $GLOBALS['TL_DCA']['tl_content']['fields'][$strField];
$strSourceField = $arrFieldDef['eval']['cropper']['sourceField'];
Expand Down Expand Up @@ -94,8 +99,18 @@ public function prepareRenderingCallback($strField,$varValue,$objTemplate,$objAt
}

$arrOptionValues = $objAttribute->get('arrOptionValues');
if(empty($arrOptionValues['cropperdata']))
{
return $strBuffer;
}

$objData = json_decode($arrOptionValues['cropperdata']);

if(empty($objData->src))
{
return $strBuffer;
}

// add the file to file database, just in case it is not yet
$objFile = \Dbafs::addResource($objData->src);

Expand Down
4 changes: 4 additions & 0 deletions system/modules/pct_image_crop/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 1.2.1
Fixed: Skip images without the cropper option (#7)
Update: Check if addImage option is set in text content elements before regenerating the element

### 1.2.0
Update: Image crop [cropperdata] is now a visible option in image attributes

Expand Down

0 comments on commit 570d92f

Please sign in to comment.