Allow for eager manipulating of images #72

Closed
reinink opened this Issue Jun 15, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@reinink
Member

reinink commented Jun 15, 2015

Remove the HTTP signature token from cache filename (getCachePath()) to prevent the regeneration of images between secured and unsecured requests.

This can be helpful in situations where you want to use secure image URLs, but you want to eagerly generate some common image variations using a server-side script. However, if it's server-side it's pointless to include the HTTP signature.

Something like this:

class Controller
{
    public function createNewUser()
    {
        // Some new user logic
        $user = new User();

        // Create image manipulations for known, common sizes
        // Really this should be pushed offer to a queue/worker
        $glide->makeImage('img/users/'.$user->id, [
            'w' => 500,
            'h' => 500
        ]);
    }
}

This will create the image manipulations right away, and will save them in the cache. Then, when that image is requested (/img/users/1.jpg?w=500&h=500) it will be ready right away.

This is an excellent way to help prevent server flooding.

@reinink

This comment has been minimized.

Show comment
Hide comment
@reinink

reinink Dec 20, 2015

Member

This is done in the upcoming 1.x release.

Member

reinink commented Dec 20, 2015

This is done in the upcoming 1.x release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment