Skip to content

This project help you get free image from unsplash and pexels

Notifications You must be signed in to change notification settings

hoangvuanhdevelopervn/FreeImage

Repository files navigation

FreeImage

FreeImage is a library that helps you get free photos and videos from Unsplash and Pexel

  • Load list image on Pexel
  • Search image on Pexel
  • Load list image on Unsplash
  • Search image on Unsplash
  • Load list video popular on Pexel
  • Search list video on Pexel

How to

To get a Git project into your build:

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

Step 2. Add the dependency

	dependencies {
	        implementation 'com.github.hoangvuanhdevelopervn:FreeImage:Tag'
	}

Step 3. Fix error. Add this code in AndroidManifest.xml

	tools:replace="android:icon,android:roundIcon,android:theme"

Usage

LoadImageFromPexel(this, pexelKey).getListImages(1, object : IPexelListImage {  
    override fun onSuccess(response: PexelImageResponse) {  
       // handle data here     
    }  
  
    override fun onError(message: String) {  
       // handle error here     
    }  
  
})


LoadVideoFromPexel(this, pexelKey).getListVideos(1, object : IPexelListVideo {  
    override fun onSuccess(pexelVideoResponse: PexelVideoResponse) {  
        Log.wtf("getListVideoPexel", "video: $pexelVideoResponse")  
    }  
  
    override fun onError(message: String) {  
        Toast.makeText(this@MainActivity, message, Toast.LENGTH_SHORT).show()  
    }  
})



LoadImageFromUnsplash(this, unsplashKey).getListImageNormal(1, object : IUnsplashListImage {  
    override fun onSuccess(images: MutableList<UnsplashObject>) {  
        Log.wtf("LoadImageFromUnsplash", "images: ${images.size}")   
    }  
  
    override fun onError(message: String) {  
        Log.wtf("LoadImageFromUnsplash", "onError: $message")  
    }  
})

Share this release:

Link

That's it! The first time you request a project JitPack checks out the code, builds it and serves the build artifacts (jar, aar).

If the project doesn't have any GitHub Releases you can use the short commit hash or 'master-SNAPSHOT' as the version.