0

I am working on a project, where I want to display all image attachments of a post. Getting the URL and size of the images is not a problem, since both get stored in the database, if the image gets edited in the media-uploader.

The problem is, that I need the alignment options as well. Sadly the alignment settings do not get stored anywhere in the database. It is only used temporary if I add the image to the post.

I need a way to store the alignment-settings in the database, if they get edited. I know I can add a custom field to the media uploader, but since there already is an Align-Field I would like to avoid duplicating it.

I do not really know where to start, as I am not very experienced in hooks and filters, or the media-uploader. Maybe there is a way to store and retrieve the setting in the attachment post meta?!

  • Alignment only makes sense in the context of display in the post. Saving alignment as an attribute of the image itself is odd, like saving "turn left right now" as an attribute of a car. – s_ha_dum May 11 '14 at 14:15
  • I think of it more in a "default display intention"-way. I use all images attached to the post as a gallery. I could set up a custom gallery for each post, but that would add unnecessary steps for the user, as well as I could not hide the editor. (The editor is not necessary because the post is just a gallery with a title) – Afterlame May 11 '14 at 14:25
  • Your gallery shouldn't have to depend upon image alignment stored in the database. Why can't your gallery code manage this? – s_ha_dum May 11 '14 at 14:27
  • It does not really depend on it. I have a default alignment for my gallery, but the user required to change it, if needed. This is not possible at the moment, since I can’t get the users input. – Afterlame May 11 '14 at 14:31
  • What happens if images have different alignments? – s_ha_dum May 11 '14 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.