Site logo

Archived topic

Page Header Image Location

4 replies · Started by Fabio Reinhardt on October 10, 2014

Viewing posts 1–5 of 5

I have hit a problem concerning the file system location of page header images. Currently, the page header addon assumes them to be at document_root + relative http path. This is not a safe assumption, since there might be web server rewrites in play. In our case, the Wordpress files are located in a sub directory, but are transparently rewritten to / by nginx. The current assumption causes the resizing / crop routine to fail (the files are not found, since the image editor looks for them in /wp-content/... instead of /wordpress/wp-content/...).

A better approach might be to handle internal Wordpress attachments and other, url-based image references differently. Attachments should be referenced by their attachment id, since Wordpress already knows their file system location. No guess work needed. ;) It can be retrieved using get_attached_file($id). This should also work for multisite.

The attachment id is readily available via the wp.media api (attachment.id), so I would be glad if you could take a shot at fixing this issue.

Thanks,
Jan Ortgies
- MdA Fabio Reinhardt -

Thanks for the info - I'll research a solution!

Really appreciate it :)

Hi there,

Just letting you know that I've changed the script that handles resizing to the popular BFI Thumb script, found here: https://github.com/bfintal/bfi_thumb

It offers an option to change the directory the images are uploaded to.

Hopefully this fixes the problem you were having.

Thanks!

Worked right out of the box now, thanks! :)

Jan Ortgies
- MdA Fabio Reinhardt -

Perfect! :)

This archived topic is closed to new replies.