You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+14
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,20 @@
2
2
3
3
## master ##
4
4
5
+
## 1.0rc1 ##
6
+
7
+
### NEW ###
8
+
* Added a wrapper for imgcache that supports Promises (qimgcache.js)
9
+
* Helpers, DomHelpers and Private classes are now available publicly via ImgCache.helpers, ImgCache.domHelpers and ImgCache.private respectively. Those are not just plain public because you generally shouldn't need them, though they're now accessible.
10
+
11
+
### FIXED ###
12
+
* Fixed issue on iOS devices (#93)
13
+
14
+
### IMPROVED ###
15
+
* Replaced tabs with whitespaces throughout the code and examples
16
+
* Readme: added a Troubleshooting section to help you solve the most common issues
17
+
* Readme: added links to angular wrappers for imgcache
When you no longer want to use the locally cached file:
136
136
137
137
```javascript
138
-
target =$('img#profile');
138
+
vartarget =$('img#profile');
139
139
ImgCache.useOnlineFile(target);
140
140
```
141
141
@@ -146,7 +146,7 @@ To remove all cached files, clear the local cache folder:
146
146
```javascript
147
147
ImgCache.clearCache(function(){
148
148
// continue cleanup...
149
-
}, function(){
149
+
}, function () {
150
150
// something went wrong
151
151
});
152
152
```
@@ -155,21 +155,27 @@ There is currently no way to invalidate single images from the cache.
155
155
156
156
High level API
157
157
--------------
158
-
* ImgCache.init() *initialises the local cache*
159
-
* ImgCache.cacheFile() *writes a copy of a file into the local cache*
160
-
* ImgCache.isCached() *checks if a the given image exists in the cache - does not check if the latest version of that file is cached*
161
-
* ImgCache.getCachedFile() *returns the cached file*
162
-
* ImgCache.getCachedFileURL() *returns the URL of the cached version of a file*
163
-
* ImgCache.useCachedFile() *replaces the img src with the cached version*
164
-
* ImgCache.useCachedFileWithSource() *similar to useCachedFile but with the image source url as extra parameter*
165
-
* ImgCache.useOnlineFile() *replaces back the img src with the original (online) version*
166
-
* ImgCache.clearCache() *clears the local cache folder*
167
-
* ImgCache.isBackgroundCached() *checks if a the given element background image exists in the cache - does not check if the latest version of that file is cached*
168
-
* ImgCache.cacheBackground() *caches the background image of an element*
169
-
* ImgCache.useCachedBackground() *replaces the background image source of the given element with the cached version*
170
-
* ImgCache.useBackgroundOnlineFile() *replaces back a background image with the original (online) version*
171
-
* ImgCache.removeFile() *removes a given file from the cache*
172
-
* ImgCache.getCurrentSize() *returns the current size of the ImgCache cache in bytes -- this is not an asynchronous method *
158
+
* ImgCache.**init**() *-- initialises the local cache*
159
+
* ImgCache.**cacheFile**() *-- writes a copy of a file into the local cache*
160
+
* ImgCache.**isCached**() *-- checks if a the given image exists in the cache - does not check if the latest version of that file is cached*
161
+
* ImgCache.**getCachedFile**() *-- returns the cached file*
162
+
* ImgCache.**getCachedFileURL**() *-- returns the URL of the cached version of a file*
163
+
* ImgCache.**useCachedFile**() *-- replaces the img src with the cached version*
164
+
* ImgCache.**useCachedFileWithSource**() *-- similar to useCachedFile but with the image source url as extra parameter*
165
+
* ImgCache.**useOnlineFile**() *-- replaces back the img src with the original (online) version // synchronous method*
166
+
* ImgCache.**clearCache**() *-- clears the local cache folder*
167
+
* ImgCache.**isBackgroundCached**() *-- checks if a the given element background image exists in the cache - does not check if the latest version of that file is cached*
168
+
* ImgCache.**cacheBackground**() *-- caches the background image of an element*
169
+
* ImgCache.**useCachedBackground**() *-- replaces the background image source of the given element with the cached version*
170
+
* ImgCache.**useBackgroundOnlineFile**() *-- replaces back a background image with the original (online) version*
171
+
* ImgCache.**removeFile**() *-- removes a given file from the cache*
172
+
* ImgCache.**getCurrentSize**() *-- returns the current size of the ImgCache cache in bytes // synchronous method *
173
+
174
+
Private methods are accessible through:
175
+
176
+
* ImgCache.helpers *-- general helper methods*
177
+
* ImgCache.domHelpers *-- DOM manipulation helper functions*
178
+
* ImgCache.private *-- private methods*
173
179
174
180
Options
175
181
-------
@@ -181,22 +187,70 @@ Overridable methods
181
187
* The hash method used by default in ImgCache is SHA-1. It was chosen for its near absence of collision. Though it might slow things down if you have a large number of files to cache (see #81). You can plug-in your own method by overriding ImgCache.overridables.hash.
182
188
* If logging is enabled, ImgCache output some log entries in the console by default. You can override ImgCache.overridables.log in order to change this behaviour.
183
189
190
+
Promises
191
+
--------
192
+
Include also [qimgcache.js](js/qimgcache.js) in your html files to be able to use its [Q Promises](https://github.com/kriskowal/q) interface if you don't like callbacks and prefer to use the simpler then/fail/progress methods.
193
+
194
+
This wrapper also makes sure the init method is always called first, so you SHOULDN'T call this method yourself when using this wrapper.
195
+
196
+
Check out the [sample code](examples/promises.html).
197
+
184
198
Unit tests
185
199
----------
186
-
Open index.html and click 'Start unit tests' to launch unit tests.
200
+
Open ```index.html``` and click 'Start unit tests' to launch unit tests.
187
201
188
202
Code samples
189
203
------------
190
-
See html files in the `examples/` folder.
204
+
Open ```index.html``` to check out several examples.
191
205
192
206
Release Notes
193
207
-------------
194
208
See [CHANGELOG](CHANGELOG.md) for the complete release notes.
195
209
210
+
Troubleshooting
211
+
---------------
212
+
213
+
Make sure you first read carefully this documentation. If you are still having issues follow this checklist:
214
+
215
+
* Set debug ON (```ImgCache.options.debug = true;```) and follow the output within the console carefully.
216
+
* Is init the first method of ImgCache to be called? (check out the console with debug ON to make sure of that)
217
+
* Add alert/console.log calls throughout your code to see what gets called and what doesn't.
218
+
* Am I running the latest version of ImgCache? If not, try with the latest version or look into the [changelog](CHANGELOG.md) for fixes related to your problem in newer releases.
219
+
220
+
If using Cordova/Phonegap, make sure you read [this documentation](CORDOVA.md) first, then double check the following:
221
+
222
+
* Are all the required plugins activated ? (config.xml)
223
+
* Are the correct permissions set? (config.xml)
224
+
* Is my code running AFTER the "deviceready" event is launched?
225
+
226
+
If you are still stuck, look for a similar problem within existing issues.
227
+
228
+
If you cannot find any, open an issue with a description of your problem, a simpler version of your code if you can.
229
+
230
+
Whenever you post an issue it's IMPORTANT you add the following details to get a quicker answer:
231
+
232
+
* ImgCache version
233
+
* Options used
234
+
* JS frameworks used with it (jQuery / Angular / Ionic ..)
235
+
* Environment : Chrome or Cordova
236
+
* If Cordova is used:
237
+
* Its version
238
+
* The version of the plugins
239
+
* The target OS (iOS / Android..)
240
+
* The target OS version (e.g: iOS 8.1)
241
+
242
+
196
243
Known issues
197
244
------------
198
245
See [KNOWN_ISSUES](KNOWN_ISSUES.md) for a list of known issues.
* Find a solution for cache invalidation when online in case an image has changed since last cached version
4
+
5
+
4
6
* When Chrome finally supports canvas.toBlob(), possibly replace download method with new one that draws an Image into a canvas and then retrieves its content using the toBlob() method -- or use [canvas-toBlob.js] (https://github.com/eligrey/canvas-toBlob.js)
5
-
* Looks like Cordova supports Blob download now, just like Chrome - add an option to use this method instead of the previous FileTransfer.download
7
+
8
+
9
+
* It looks like Cordova supports Blob download now, just like Chrome - add an option to use this method instead of the previous FileTransfer.download
0 commit comments