I've implemented a plugin for synchronizing an external Database into my Craft project which also includes images.

Those images have a focuspointer but i lose the focuspointer onSaveEntry by my plugin. (I'm using the Focuspointer Plugin)

Note: I only lose the focuspointer when updating an entry by my plugin, updating an entry by control panel works fine.

This is the code from the focuspointer plugin where the focuspoint get's deleted:

public function onAfterElementSave()

    $hash = spl_object_hash($this->element);

    $value = isset($this->values[$hash]) ? $this->values[$hash] : null;

    if ($value && isset($value["focus-attr"])) {
        $i = 0;
        foreach ($value["focus-attr"] as $focus_attr) {


How can I prevent the loss of the focus point onSaveEntry by my plugin?


I recently had the same problem when saving entries in my plugin. I only wanted to update an entry field that had nothing to do with the focus image and save that entry. Turned out the focus image lost its value (I think it happens only when the field is required).

I solved it by getting the value of the focusImageField and just re-set it when saving the entry:

// imageWithFocusPoint is required but returns empty,
// so set it with same value it allready had
   'imageWithFocusPoint' => $entry->imageWithFocusPoint->ids(),


More info that helped me here: http://goo.gl/soli9T

Another solution (and the one I used but maybe less of an option for you) is to disable validation on the entry save. By using:

craft()->content->saveContent($entry, false);

instead of saveEntry. The "false" as second parameter means it will not validate the entry which is not always necessary.


I was running into this same issue where all of the focal points were being lost when saving entries from the command line. I wrote a pull request to fix the issue that was recently merged, so this should hopefully no longer be an issue as of version 1.1.7. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.