sqlpage.persist_uploaded_file function / resize parameter ? #667
Closed
SebastiendOrnano
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Hello and thank you for getting in touch ! persist_uploaded_file is not specific to images, and SQLPage being a lightweight framework cannot really integrate the complexity of image decoding and encoding for dozens of image format. You can easily achieve what you want by calling imagemagick directly from SQLPage, using sqlpage.exec, though: https://sql.datapage.app/functions.sql?function=exec#function |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a table "members" to describe the members of an organization.
I want to include picture for each member and use this picture in a visual directory (trombinoscope) with the carousel or datagrid or a table component. It works but I have to play with a local.css to fit correctly the picture in the carousel ou the datagrid. A common way to avoid to play with the css is to resize the original picture in 3 different size : large, medium, small before uploading them in 3 different columns : member_picture_L, member_picture_M, member_picture_S. It works if the admin is doing the resizing but it is not convenient if the user is asked to upload is own picture.
Could it be possible to integrate a new parameter "resize" in sqlpage.persist_uploaded_file function such as
sqlpage.persist_uploaded_file('profile_picture', 'profile_pictures', 'jpg,jpeg,png,gif,webp, 320')
where 320 would be the max height as in an imagick convertion
convert input.png -resize x300 output.png
if the max height is not defined, the image is not resized.
with such a parameter, it would be possible to produce 3 pictures from the original file with an expression such as
UPDATE members SET member_picture_title=:member_picture_title, member_picture_L=sqlpage.persist_uploaded_file('member_picture', 'x_img', 'jpg,jpeg,png,gif',320), member_picture_M=sqlpage.persist_uploaded_file('member_picture', 'x_img', 'jpg,jpeg,png,gif',120), member_picture_S=sqlpage.persist_uploaded_file('member_picture', 'x_img', 'jpg,jpeg,png,gif',40), WHERE member_id =$member_id
and so a standard user can upload his id picture without to check the size.
I am not a developper so I don't know the amount of work it involves (but anyway, thanks a lot for sqlpage !)
Beta Was this translation helpful? Give feedback.
All reactions