Jump to content

Adding images with API - not taking settings of field into account


KarlvonKarton
 Share

Recommended Posts

Is it true that when you add an image to the images field, that the image will be uploaded without taking the settings of that field into account?
So if I set the input of the images field to max width: 3000px, then an image of 6000px width will stay that size after adding it with the API?

Link to comment
Share on other sites

5 hours ago, KarlvonKarton said:

Is it true that when you add an image to the images field, that the image will be uploaded without taking the settings of that field into account?

Yes, it is true, because all of those settings are handled by the image inputfield and when you add an image via the API the inputfield is not involved.

So you have to do you own checks, resizing, etc. For some starting code take a look at my AddImageUrls module: https://github.com/Toutouwai/AddImageUrls/blob/bed9f2a910c3b120756e35e84ff734f345160bfa/AddImageUrls.module#L119-L171

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...