Giter VIP home page Giter VIP logo

Comments (7)

dmitry-mukhin avatar dmitry-mukhin commented on July 26, 2024

Matt,

take a look at #67.
Effects are being preserved in File instance if it's created from a Group.

from uploadcare-php.

dmitry-mukhin avatar dmitry-mukhin commented on July 26, 2024

@MattWohler ?

from uploadcare-php.

MattWohler avatar MattWohler commented on July 26, 2024

I don't see the benefit of accessing it via group over individual file, but it's your choice as to implement it or not. In my use-case, the user creates their own cropped image and I need to preserve those cropped dimensions.

In this case, are we encouraged to use File Groups?

from uploadcare-php.

dmitry-mukhin avatar dmitry-mukhin commented on July 26, 2024

@MattWohler the individual files do not store the cropping info in any form, it is only available in groups.
You'll have to save the file URL returned by the widget to have the cropping info.

So the question to you is what you're actually putting into your DB when you save files?

from uploadcare-php.

dmitry-mukhin avatar dmitry-mukhin commented on July 26, 2024

resolved in #67

from uploadcare-php.

MattWohler avatar MattWohler commented on July 26, 2024
id user_id avatar_uuid avatar_crop_size
1 1 b39ds8f39f-4387-4cc0-3118-bc49sh8984a7 crop/239x239/145,24

Where my code ends up looking something like the following:

        $fileUrl = $request->input('avatar');
        $file = $this->api->getFile($fileUrl);

        $startAt  = strpos($fileUrl, 'crop');
        $stopAt   = strpos($fileUrl, '/-/preview');
        $cropSize = substr($fileUrl, $startAt, ($stopAt - strlen($fileUrl)));

        $userProfile->avatar_uuid = $file->getFileId();
        $userProfile->avatar_crop_size = $cropSize;

from uploadcare-php.

dmitry-mukhin avatar dmitry-mukhin commented on July 26, 2024

Not sure if gihub is a good place for this :)

But anyway, if you instantiate File with full URL, returned by the widget, you get the cropping and your code successfully extracts it (take a look at $file->default_effects though).

Uploadcare does not have this info (for individual files), and hence cannot give it to you via REST API.

from uploadcare-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.