· 4 years ago · Apr 26, 2021, 07:50 PM
1<?php
2// PRESS CONTROL + U TO VIEW THE SOURCE CODE
3// ONCE YOU THERE REMOVE DIE AND REFRESH THE PAGE YOU JUST OPENED SHOULD BE view-source:
4die();
5
6// $array[file_number][['SPOILER NAME', 'SHORT NAME TO DISPLAY IN TABLE']]
7// FIRST IMAGE IS A SPIKED TARGE = 0
8// LAST SPIKED TARGE IS N°32
9// WE ARE MOVING TO THE NEXT SPOILER AT N°33
10$array = [0 => ['Spiked Targe', 'ST'],
11 33 => ['Wooden Buckler', 'WB'],
12 62 => ['Round Shield', 'RS'],
13 103 => ['Skeleton Shield', 'SS'],
14 150 => ['Reinforced Buckler', 'RB'],
15 182 => ['Diamond Aegies','DA'],
16 196 => ['Bladed Shield', 'BL'],
17 236 => ['Ornate Buckler', 'OB'],
18 267 => ['Shield Of The Wing', 'SW'],
19 297 => ['Bronze Shield', 'BS'],
20 329 => ['Aegis', 'A'],
21 354 => ['Defender', 'D'],
22 379 => ['Tall Shield','TS'],
23 416 => ['Other Shield', 'OTH']];
24
25// glob("./images/*.jpg") will take all jpg pictures that are in the folder images
26$files = glob("./images/*.jpg");
27
28// TO GET A CLIENT ID YOU NEED TO REGISTER THERE : https://api.imgbb.com/
29// SIGN IN AND GO BACK TO https://api.imgbb.com/
30// CLICK ON ADD API KEY
31$client_id = "XXXXXXXXXXXX";
32
33$j=1;
34
35//419 is the number of images that you need to upload => you have 420 in total cause 0 count
36for($i = 0; $i <= 419; $i++){
37 //IF YOU GET TIME OUT, COUNT HOW MANY IMAGES YOU DID UPLOAD
38 // REMOVE COMMENT BELLOW AND CHANGE THE NUMBER TO UPLOAD THE MISSING ONES
39 //if($i >= 297){
40 $filename = $files[$i];
41 $handle = fopen($filename, "r");
42 $data = fread($handle, filesize($filename));
43 $pvars = array('image' => base64_encode($data));
44 $timeout = 30;
45
46 $API_KEY = 'e0d32f6b2a95b33ec67c8ba13091f68c';
47 $ch = curl_init();
48 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
49 curl_setopt($ch, CURLOPT_URL, 'https://api.imgbb.com/1/upload?key='.$API_KEY);
50 curl_setopt($ch, CURLOPT_POST, 1);
51 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
52 curl_setopt($ch, CURLOPT_POSTFIELDS, $pvars);
53 $out = curl_exec($ch);
54 curl_close ($ch);
55 $pms = json_decode($out,true);
56 $url = $pms['data']['url'];
57
58 if($j == 1 && isset($array[$i])){
59 $storedI = $i;
60 echo "<woltlab-spoiler data-label='{$array[$storedI][0]}'><table><tbody><tr><td></td><td>C/O</td><td>R/B</td><td>B/O</td><tr>";
61 }
62
63 $name = $array[$storedI][1].$j;
64 echo "<tr><td><img src='{$url}'>{$name}</td><td></td><td></td><td></td></tr>";
65 $j++;
66
67 if(isset($array[$i+1])){
68 $j = 1;
69 echo "</tbody></table></woltlab-spoiler>";
70 }
71 //}
72
73}
74
75// ONCE SOURCE CODE IS FULLY DISPLAYED, YOU CAN COPY PAST IT TO LEGACY