wordpress-settings-api-class
wordpress-settings-api-class copied to clipboard
Add image field type
Works the same as file field type but with a preview of the image.
Signed-off-by: Roi Dayan [email protected]
hi, any comments?
Hi @tareq1988 any comments?
Sorry for the long delay on reviewing this. Ideally I would like to store the attachment ID instead of image URL as we might need various sizes of that image and finding an attachment ID with URL will be a nightmare. So we could pass the attachment ID as a hidden field, a thumbnail version of the image preview (right now it shows the full size). Also limit the media manager to image-only selection, we certainly don't want to select a zip file as an image file.
ok thanks for the comments.
The point at first was to be able to supply external url as well. With your suggestions only the button and preview are needed (without the input box). the media manager has an upload tab to add external file into the media manager.
another note. showing the original image was the point of showing the user the real preview of the size that is going to be used. i.e. i use it for adding image for email header and wanted the user to see preview of the image in real size. I guess this could be configurable of what kind of preview to show.
Consider a raw image uploaded, or a fairly medium sized 1200x800, it would overflow the whole settings area.
right, but in my example if i requested header email image then it can be considered a user mistake choosing image size that large. the default can be thumb if not specified. i'll split this into different commit later.
hi @tareq1988 , too bad this didn't get merged. I would like to revive this. we talked about user attaching raw img and code was updated to show thumbnail is exists. i see a rebase is needed so i'll do that after some comments.
@roidayan and @tareq1988 just tested this code within my project and all in working, great. Thank @roidayan
Definitely prefer the image field over the file, easier for my client to see what they have attached.
If you need help maintaining the repo will be happy to help, I see there are a few pull requests outstanding.
thanks. i'm still using this plugin as well. great thing.