URL and Link repository

Friday, November 14, 2014

My PHP Code for Resizing Images into a Second Directory.

function compress_image($orig_url, $new_url, $quality) {
$info = getimagesize($orig_url);
if ($info['mime'] == 'image/jpeg') 
$image = imagecreatefromjpeg($orig_url);
elseif ($info['mime'] == 'image/gif') 
$image = imagecreatefromgif($orig_url);
elseif ($info['mime'] == 'image/png') 
$image = imagecreatefrompng($orig_url);
imagejpeg($image, $new_url, $quality);
return $new_url;
$sql = "SELECT
`idtags` as `id`,
`height` as `elevation`,
`title` as `title`,
 '0' as `distance`,
 '1' as `has_detail_page`, 
`url` as `url`,
`created` as `when`,
`private` as `priv`
FROM `tags` order by `created` desc;";
$result = mysql_query($sql) or trigger_error 
('JSON download error'.mysql_error(),E_USER_ERROR);
for ($i = 0; $i < mysql_num_rows($result); $i++){
$row = mysql_fetch_array($result);
$imgUrl = $row['url'];
$title = $row['title'];
$url = str_replace("%3A",":", $imgUrl);
$url2 = str_replace("%2F","/",$url);
$name = substr($url2, 29);
$url4 = "myNewImageFolder/".$name;
compress_image($url2, $url4, 75);

Thursday, November 13, 2014

Android: Command Line SQLite

On my Samsung Galaxy Tab 2 running Cyanogemod Kit Kat under a second user account, my databases are under the following directory: "/user/10/com.s33me.scribpass2/databases". Then I type: "sqlite3 scribdb2" followed by ".tables";