-
Notifications
You must be signed in to change notification settings - Fork 10
/
readme.txt
127 lines (68 loc) · 4.73 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
=== ACF: Focal Point ===
Contributors: evuze
Donate link: https://github.com/evu/acf-focal_point
Tags: acf, advanced custom fields, wp, wordpress, focal-point, photography, image, responsive, responsify
Requires at least: 4.2
Tested up to: 4.2
Stable tag: 1.0.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Adds a new field type to ACF allowing users to draw focal points on images. Utilises Responsify.js
== Description ==
Adds a new field type to ACF allowing users to draw focal points on images. Uses Wenting Zhang's [Responsify.js](https://github.com/wentin/ResponsifyJS/) to create focal points on images using jQuery.
Works similar to a traditional ACF image field, but once an image is selected and a preview is displayed, this plugin allows drawing a box around a focal point in the image using canvas. That image can then be displayed in a nice responsified fashion. View the [ResponsifyJs](http://responsifyjs.space/) homepage for a demo.
Image returned as either tag or object to use within themes. Includes responsify.js.
See Frequently Asked Questions for more info and detailed usage.
Last tested on ACF v4 (4.4.5) & ACF Pro (5.3.3.2).
== Installation ==
Since this a WordPress plugin just search for "ACF: Focal Point" in the plugins section in the admin and install it from there. If you would rather install it manually you can do the following:
1. Download and extract the plugin
2. Copy the `acf-focal_point` folder into your `wp-content/plugins` folder
3. Activate the Focal Point plugin via the plugins admin page
4. Create a new field via ACF and select the Focal Point type
5. Please refer to the Frequently Asked Questions for more info regarding the field type settings
== Frequently Asked Questions ==
= How do I use it? =
Pretty much just like an [ACF Image Field](http://www.advancedcustomfields.com/resources/image/). There's a few differences, like not returning just an ID (there's no point without positions), but the basics are the same.
Make sure the Preview Size and Return Size are of a similar ratio. And make sure the image parent has a height.
Image tag returns some additional markup on images:
`<img class="js-focal-point-image" src="img.png" alt="image alt" data-focus-left="0.12" data-focus-top="0.11" data-focus-right="0.40" data-focus-bottom="0.98">`
The Image object now has a few more values too:
`
'focal_point' => array(
'class' => 'js-focal-point-image',
'top' => $value['top'],
'left' => $value['left'],
'right' => $value['right'],
'bottom' => $value['bottom']
)
`
`'class'` refers to the class that Responsify.js is called on. This needs to be on the image tag to work.
`'top', 'left', 'right' and 'bottom'` refer to the `data-focus` attributes used to control focal point.
Build image as per above tag. Responsify is called on load and resize automatically on `img.js-focal-point-image`.
= Why are the images returned huge? =
Make sure the image is wrapped inside an element that has a height and hasn't had it's `overflow: hidden` overridden (by `!important`). And that the image hasn't had it's `max-width: none` overridden.
= Why are the images returned small? =
Make sure the return image size (set when creating a Focal Point field) isn't set to a small image size. Larger images work better.
= Why are the images not stretching to fill it's container? =
Responsify.js tries it's best to fit as much of the photo in the container as it can, whilst keeping the focal point a priority, and also keeping ratios correct. This means that at some sizes/ratios your image will be displayed too small for it's container, try changing container size or image size. Or use `background-size: cover`.
= Why are the images not scaling? =
Because for this to work, the image needs to move around within a container. Which means we need to hide the containers overflow. Which means we need to set a height. This is not made for wysiwyg style images, it's for banners, sliders, fullpage, fixed height sections, etc.
= Why is the focus area not lining up correctly when I view the page/post? =
Make sure that the preview size and the return size are the same ratio. It's relatively accurate when they're close, but for best results they should be the same. And make sure any image sizes aren't differing their crops.
== Upgrade Notice ==
Nothing to upgrade just yet!
== Screenshots ==
1. Creating a Focal Point Field.
2. Selecting a Focal Point for the selected image.
3. Desktop width image on 2016 Theme.
4. Same image at mobile width.
== Changelog ==
= 1.0.0 =
* Initial version
= 1.0.1 =
* Fixed bug with image not displaying on changing acf tabs.
* fixes missing class from delete icon
* fixed undefined variables
= 1.0.2 =
* Fixed bug with image not resizing on changing custom acf tabs.