Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
serifgungor authored Sep 8, 2020
1 parent b454115 commit 5dcaf85
Show file tree
Hide file tree
Showing 27 changed files with 1,377 additions and 1,468 deletions.
107 changes: 8 additions & 99 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
![Photto Image Cache](/phottov4.jpg)
# Photto
Photto is a Image Upload, Image Caching, Picture Display, Photo Collage and Image Zoom Library for Android Projects.
Photto is a Image Upload, Image Caching and Picture Display Library for Android Projects.

- Project by [@serifgungor](https://github.com/serifgungor) and Generated in 26.07.2019. Last revision at 07.09.2019
- Project by [@serifgungor](https://github.com/serifgungor) and Generated in 26.07.2019. Last revision at 04.08.2019

# Installation
[![](https://jitpack.io/v/gungoronline/Photto.svg)](https://jitpack.io/#gungoronline/Photto)

Gradle
```groovy
allprojects {
Expand All @@ -16,24 +13,22 @@ allprojects {
}
}
dependencies {
implementation 'com.github.gungoronline:Photto:0.5.0'
implementation 'com.github.gungoronline:Photto:0.2.0'
}
```
or Maven
```xml
<dependency>
<groupId>com.github.gungoronline</groupId>
<artifactId>Photto</artifactId>
<version>0.5.0</version>
<version>0.2.0</version>
</dependency>
```


# How to use ?

## PhottoBuilder (Class)
![Photto Image View](/from_image.jpg)

## PhottoBuilder class
### FROM URI
```groovy
new Photto.PhottoBuilder(
Expand Down Expand Up @@ -122,10 +117,7 @@ new Photto.PhottoBuilder(
).build();
```

## UploadBuilder (Class)
![Photto Image Upload](/ftp_upload.jpg)

[Video on YouTube - Photto ImageUpload](https://youtu.be/6BrEVHpUv1s)
## UploadBuilder

The easiest way, upload your images to the web server !

Expand Down Expand Up @@ -164,23 +156,6 @@ if($_POST){
}
?>
```
-- C#(ASP.net) Not tested yet
```groovy
public Image Base64ToImage(string base64String)
{
// Convert base 64 string to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
// Convert byte[] to Image
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
{
Image image = Image.FromStream(ms, true);
return image;
}
}
string value = Request.Form["imgBase64"];
Image img = Base64ToImage(value);
img.Save(path);
```

### UPLOAD FROM IMAGEVIEW WITH RESIZED (Version: 0.3.0)
- 600x600 (Upload Test Result: 00.04.68sec upload time)
Expand All @@ -197,87 +172,21 @@ HashMap<String, String> hm = new HashMap<String, String>();
new Photto.UploadBuilder("https://siteurl.com/test.php",hm,0,imageView).upload();
```

## PhotoView (View Class)

![Photto Image Zoom](/imageview_zoom.jpg)

### ZoomTouchView (Added This Version: 0.4.0)
ImageView supported Double-Touch to Zoom and Pinch to Zoom !

```groovy
<com.gungoronline.photto.PhotoView.ZoomTouchView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="@mipmap/ic_launcher" />
```

## BitmapBuilder (Class)

### Bitmap Type 1
![Photto Image Upload](/bitmapbuilder.png)
```groovy
File[] files = new File[]{new File("/storage/emulated/0/tr.jpg")};
Bitmap b = new Photto.BitmapBuilder(getApplicationContext(),files,"@serifgungor", BitmapType.TYPE_1).build();
iv.setImageBitmap(b);
```

### Bitmap Type 2
![Photto Image Upload](/bitmapbuilder2.png)
```groovy
File[] files = new File[]{new File("/storage/emulated/0/photo1.jpg"),new File("/storage/emulated/0/photo2.jpg")};
Bitmap b = new Photto.BitmapBuilder(getApplicationContext(),files,"", BitmapType.TYPE_2).build();
iv.setImageBitmap(b);
```

### Bitmap Type 3
![Photto Image Upload](/bitmapbuilder3.png)
```groovy
File[] files = new File[]{new File("/storage/emulated/0/picture1.jpg"),new File("/storage/emulated/0/picture2.jpg")};
Bitmap b = new Photto.BitmapBuilder(getApplicationContext(),files,"", BitmapType.TYPE_3).build();
iv.setImageBitmap(b);
```
### Bitmap Type 4
![Photto Image Upload](/bitmapbuilder4.png)
```groovy
File[] files = new File[]{new File("/storage/emulated/0/picture1.jpg")};
Bitmap b = new Photto.BitmapBuilder(getApplicationContext(),files,"", BitmapType.TYPE_4).build();
iv.setImageBitmap(b);
```
### Bitmap Type 5
![Photto Image Upload](/bitmapbuilder5.png)
```groovy
File[] files = new File[]{
new File("/storage/emulated/0/picture1.jpg"),
new File("/storage/emulated/0/picture2.jpg"),
new File("/storage/emulated/0/picture3.jpg"),
new File("/storage/emulated/0/picture4.jpg")
};
Bitmap b = new Photto.BitmapBuilder(getApplicationContext(),files,"", BitmapType.TYPE_5).build();
iv.setImageBitmap(b);
```

# Change Logs
## 26.07.2019
- Version 0.1.0 has launched. (PhottoBuilder class created.FROM URL, FROM URI, FROM BASE64 STRING, FROM ASSETS FOLDER, FROM DRAWABLE added)
## 27.07.2019
- Version 0.2.0 has launched. (FROM FILE, FROM URL WITH IMAGE LOAD LISTENER added)
## 04.08.2019
## 03.08.2019 (Now Adding)
- Version 0.3.0 has launched. (UploadBuilder class created. You can upload the imageView content to the Web site)
## 07.09.2019
- Version 0.4.0 has launched. (ZoomTouchView added. ImageView Supported Pinch Zoom and Double-Touch Zoom)
## 01.08.2020
- Version 0.5.0 has launched.
- The new version comes with the BitmapBuilder class. BitmapBuilder Type1, Type2 and Type3 is OK ! (27.02.2020)
- BitmapBuilder Type4 and Type5 is OK ! (02.03.2020)

# Maybe later... (0.6.0)
# Maybe later... (0.4.0)
- You got a new idea? Send a message to: contact@serifgungor.com

Helpers
--------
- Java Thread, AsyncTask classes used.
- Java HttpUrlConnection/HttpsUrlConnection classes used.
- chrisbanes / PhotoView Library

License
--------
Expand Down
62 changes: 31 additions & 31 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.gungoronline.photto"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':photto')
}
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.gungoronline.photto"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':photto')
}
42 changes: 21 additions & 21 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
package com.gungoronline.photto;

import android.content.Context;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.gungoronline.photto", appContext.getPackageName());
}
}
package com.gungoronline.photto;

import android.content.Context;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.gungoronline.photto", appContext.getPackageName());
}
}
40 changes: 20 additions & 20 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gungoronline.photto">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gungoronline.photto">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Loading

0 comments on commit 5dcaf85

Please sign in to comment.