• Resolved jhdean

    (@jhdean)


    Hello David,

    Is there a way to specify that an image slug becomes the file_name rather than what seems to default to the image title? I can see how I can put the file name into another IPTC field and then map it to the slug field but that is a fair amount of work. I don’t see the file_name in the IPTC mapping popup list.

    What I am noticing is that if I upload a group of images that are named sequentially:
    picture-1
    picture-2
    picture-3
    each with the title Picture,
    and then make a page with the same name; Picture, the page slug becomes picture-4 rather than picture as it should. This suggests that each image is getting the slug name from it’s title and so is adding a sequence number to avoid duplicates. The first image uploaded steals the slug for the yet to be created page.

    So, I then have to create the page first and then upload the images which is not always ideal.

    This is all to work with the Detail page template you helped me with, being able to make a new page and only have to give it the title of the group of images that relate to it before publishing.

    Thanks,
    Jeff

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 1 replies (of 1 total)
  • Plugin Author David Lingren

    (@dglingren)

    Good to hear from you again. Thanks for an interesting question and for the time you took to provide the detailed explanation. Your description of the slug generation process is right; the WordPress default slugs are derived from the Title.

    You can use a Content Template to use any Data Source for an ITPC/EXIF mapping rule. In the “EXIF/Template” textbox to the right of the IPTC dropdown list, enter something like:

    template:([+file_name+])

    Set the Priority dropdown to EXIF and the Keep Existing dropdown to Replace.

    If you use file_name as the data source you will get slug values such as picture-1-jpg. If you use name_only as the data source you will get picture-1, which might be better.

    I did some testing and everything seems to be fine with this mapping rule. I am marking this topic resolved, but please update it if you have any problems or further questions about generating slug values from data sources such as the file name. Good luck with your application.

Viewing 1 replies (of 1 total)
  • The topic ‘Image slug’ is closed to new replies.