Skip to content

Don't store the exact same preview every time we check for its existence #16544

Closed

Description

@oparoz

The Preview class uses a resize method to check if a cached preview already has the proper dimensions, but the calling method doesn't know if a new preview had to be created and saves what it has every time.

https://github.com/owncloud/core/blob/master/lib/private/preview.php#L586

/**
 * Resizes, crops, fixes orientation and stores in the cache
 *
 * @param int $fileId fileId of the original image
 */
private function resizeAndStore($fileId) {
    // Resize and store
    $this->resizeAndCrop();
    // We save a copy in the cache to speed up future calls
    $cachePath = $this->buildCachePath($fileId);
    $this->userView->file_put_contents($cachePath, $this->preview->data());
}

Activity

  1. self-assigned this
    on May 23, 2015
  2. added this to the milestone on May 29, 2015
  3. oparoz commented on May 29, 2015

    @oparoz
    ContributorAuthor

    The fix is in #16382

  4. locked as resolved and limited conversation to collaborators on Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions