如何在linux命令行中设置图像路径?

时间:2015-12-19 18:39:14

标签: linux

如何在linux命令行中设置图像路径?

我尝试使用此图片路径

/home/testuser/public_html/img/test.jpg

在linux命令行中使用此代码(putty

jpegoptim --max=75 /home/testuser/public_html/img/test.jpg

但不行,我该怎么做?

1 个答案:

答案 0 :(得分:2)

确保文件存在且可读。该目录也应该是可写的。

尝试

var name, logo, streaming, twitchfeed;
var users = ["freecodecamp", "medrybw", "geoffstorbeck",
    "terakilobyte", "habathcx", "robotCaleb",
    "thomasballinger", "noobs2ninjas", "beohoff", "boonyzarc"
];

function getInfo() {

    var usersTotal = users.length;
    var userCounter = 0;


    function getNextUser() {

        if (usersTotal > userCounter) {

            var user = users[userCounter];
            var channelURL = 'https://api.twitch.tv/kraken/channels/' + user + '?callback=?';
            var streamURL = 'https://api.twitch.tv/kraken/streams/' + user + '?callback=?';

            $.getJSON(channelURL, function (channel) {
                $.getJSON(streamURL, function (stream) {
                    if (stream.stream === null) {
                        streaming = '<span class="label label-danger pull-right label-rawle offline"><span class="glyphicon glyphicon-thumbs-down" aria-hidden="true"></span></span>';
                    } else {
                        streaming = '<span class="label label-success pull-right label-rawle online"><span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span></span>';
                    }
                    twitchfeed = channel.url;
                    console.log(twitchfeed);
                    name = channel.display_name;

                    if (channel.logo === null) {
                        channel.logo = 'https://c1.staticflickr.com/1/186/382004453_f4b2772254.jpg';
                    }
                    logo = '<img src="' + channel.logo + '" class="logo">';

                    $('#person').append('<div class="user" id="' + name + '">');
                    $('#' + name).append(logo + '<a href="' + twitchfeed + '" TARGET="_blank">' + '<span class="name">' + name + '</span>' + '</a>' + '</div>' + streaming);
                    $('#' + name).append('<div class="topic">' + stream.stream.channel.status + '</div>');


                });

                // what happens when tabs are clicked
                $(function () {

                    // 'all' tab
                    $('#all').click(function () {

                        $('#all').addClass('active');
                        $('#online').removeClass('active');
                        $('#offline').removeClass('active');

                        $(".user").show();
                    });
                });

// 'online' tab
                $('#online').click(function () {

                    $('#all').removeClass('active');
                    $('#online').addClass('active');
                    $('#offline').removeClass('active');

                    $(".user").each(function () {
                        if ($(this).children(".offline").length < 1) {
                            $(this).show();
                        } else {
                            $(this).hide();
                        }
                    });
                });

// 'offline' tab
                $('#offline').click(function () {
                    $('#all').removeClass('active');
                    $('#online').removeClass('active');
                    $('#offline').addClass('active');

                    $(".user").each(function () {
                        if ($(this).children(".offline").length < 1) {
                            $(this).hide();
                        } else {
                            $(this).show();
                        }
                    });
                });
            });

        }

        userCounter++;
        getNextUser();

    }

    getNextUser();
}

//Trying to add a user
/*$('#submit-rawle-button').click(function(){
 var $newUser = $('#newUser').val();
 if(users.indexOf($newUser)==-1)
 {
 users.push($newUser);
 }
 getInfo();
 });*/

getInfo();

sudo chmod 666 /home/testuser/public_html/img/test.jpg