How to handle reletive path in awesome-wm - lua

In my 'rc.lua' file I currently have the following code:
naughty.notify({
preset = naughty.config.presets.info,
text = "MPC: Play!",
icon = "/home/user/.config/awesome/icons/mpd.png",
icon_size = 20,
})
How can make the following icon path work, instead?
icon = "~/.config/awesome/icons/mpd.png",

If awesome-wm does not have direct support for this, use
icon = os.getenv("HOME").."/.config/awesome/icons/mpd.png"
or
icon = string.gsub("~/.config/awesome/icons/mpd.png", "~", os.getenv("HOME"))

Related

custom icon from url, not from assets - nativescript google maps ios

I try a lot but not success to find a way to show icon of marker from url.
addMarker(mark, index): void {
const marker = new Marker();
marker.position = Position.positionFromLatLng(mark.latitude, mark.longitude);
marker.icon = 'iconsdb.com/icons/preview/red/map-marker-2-xxl.png'; // default pin
this.mapView.addMarker(marker);
}
Using this for icons image from assets was working fine. now I have icons stored on cloud and I need to use them as per record.
Since loading image from assets works with an ImageSource, I believe you should be able to do a similar thing for images from URL. Also see documentation
The ImageSource has a 'fromUrl' you can call. So this should work for you (borrowing part of the code from your linked question)
let imgSrc = new ImageSource();
imgSrc.fromUrl("iconsdb.com/icons/preview/red/map-marker-2-xxl.png");
let image = new Image();
image.imageSource = imgSrc;
marker.icon = image;
You should probably cache the image so it won't be downloaded x times.

How do I properly crop a photo for profile picture?

I am allowing users to select their profile picture, but when I import it and cut the borders and make it round, it looks very weird. Is there a proper way to do this?
propic.layer.borderWidth = 2
propic.layer.masksToBounds = false
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.clipsToBounds = true
Try this
propic.layer.borderWidth = 2
propic.layer.borderColor = UIColorFromRGB("ffffff").CGColor
propic.layer.cornerRadius = propic.frame.height/2
propic.layer.masksToBounds = true

Is there a way to set the .skinActive(“#fefa01”) property for the iOS player (JWplayer)

Is there a way to set the .skinActive(“#fefa01”) property for the iOS player (JWplayer / JWConfig class) ?
https://support.jwplayer.com/customer/portal/articles/1406968-using-jw-player-skins
skin.active
Active skin elements. This includes active and highlighted labels, as well scrubber time that has elapsed .
skin.inactive
Skin elements that are not active. This includes scrubber time that has not yet elapsed.
skin.background
The background portion of the control bar.
// iOS Config
// basic config
JWConfig *config = [JWConfig new];
config.image = nil;
config.title = #" ";
config.controls = YES; //default
config.repeat = NO; //default
config.offlineMessage = NSLocalizedString(#"connection.title", nil);
//config.premiumSkin = JWPremiumSkinSeven;
//custom skin can be applied using:
config.cssSkin = #"http://urltomycustomcssfile.css";
Or is it possible to workaround this by overwriting the proper css styles using config.cssSkin ? I tried but I don't know which styles to overwrite and if this works as well.
i.e.
.jw-skin-seven .jw-progress {
background: #fefa01;
}
Unfortunately, there is currently no way to do that on the iOS SDK. JWplayer will create a feature request for a future release.
https://support.jwplayer.com/customer/en/portal/questions/16101445-is-there-a-way-to-set-active-skin-elements-ios-sdk-?new=16101445

Corona always display a black screen in the build

I'm trying to make a build with Corona for Android devices.
Is a very simple app, only use a reference to de 'ui'
local ui = require("ui");
local btnright = ui.newButton{
defaultSrc = "button-right.png",
defaultX = 100,
defaultY = 100,
overSrc = "button-right-over.png",
overX = 100,
overY = 100,
onEvent = buttonHandler,
id = "btn-right"
}
But, when I generate the apk, only display me a black screen and in the simulator shows me the button
in android when naming the file or the image you must not use special character it must only contain [a-z0-9_.] and no capital letters too. you can see the widget button on corona simulator because simulator can read special character.
for more details about resource names refer to this link
and change your widget name from:
local ui = require("ui");
local btnright = ui.newButton{
defaultSrc = "button-right.png",
defaultX = 100,
defaultY = 100,
overSrc = "button-right-over.png",
overX = 100,
overY = 100,
onEvent = buttonHandler,
id = "btn-right"
}
to this
local ui = require("ui");
local btnright = ui.newButton{
defaultSrc = "button_right.png",
defaultX = 100,
defaultY = 100,
overSrc = "button_right_over.png",
overX = 100,
overY = 100,
onEvent = buttonHandler,
id = "btn-right"
}
Which version of corona are you using?
Why not try the widget.newButton()?
check this out. http://docs.coronalabs.com/api/library/widget/newButton.html
Capital letters are allowed. I'm not sure about hyphens, but they are valid characters in Linux and Unix (the core OS used by Android and iOS) However what is likely the cause is case sensitivity. Devices like Android and iOS are case sensitive. The simulator is not, so if you have a button named:
button-right.png
And the actual file name is:
Button-right.PNG
it won't match and it will generate an error. You need to tether your device to your computer and view the device's console log. If you do not know how to do that please see this blog post:
http://www.coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Adding a gif to a larger background

I'm using imagemagick to resize uploaded files but while they're processing I want to show a rotating gif wheel to the user where the thumbnail would normally be. I serve about 7 sizes of thumbs and would like the wheel to remain at it's 32x32 size in the middle, that's the simple bit.
What I need to know is, can I do the above while still retaining the animation
Example:
This Image:
Starting at this size
With Animation
Check out this fiddle, it might contain what you want: http://jsfiddle.net/TGdFB/1/
It uses jQuery, but should be easily adaptable...
Ended up doing this manually by Photoshop after not being able to find an automated way of doing this through imagemagick. I found the 'coalesce' flag but not much else.
there is a solution in php witch i use to watermark gif animated images ....
it create an black bacground put an image on it and then put watermark ...
watermarkpath = 'path to wathermarkimage.jpg|gif|png';
$imagepath= 'path to the image';
$watermark = new Imagick($watermarkpath);
$GIF = new Imagick();
$GIF->setFormat("gif");
$animation = new Imagick($imagepath);
foreach ($animation as $frame) {
$iWidth = $frame->getImageWidth();
$iHeight = $frame->getImageHeight();
$wWidth = $watermark->getImageWidth();
$wHeight = $watermark->getImageHeight();
if ($iHeight < $wHeight || $iWidth < $wWidth) {
// resize the watermark
$watermark->scaleImage($iWidth, $iHeight);
// get new size
$wWidth = $watermark->getImageWidth();
$wHeight = $watermark->getImageHeight();
}
$bgframe = new Imagick();
$bgframe->newImage(($iWidth), ($iHeight + 80), new ImagickPixel('Black'));
$bgframe->setImageDelay($frame->getImageDelay());
$x = ($iWidth) - $wWidth - 5;
$y = ($iHeight + 80) - $wHeight - 5;
$bgframe->compositeImage($frame, imagick::COMPOSITE_DEFAULT, 0, 0);
$bgframe->flattenImages();
$bgframe->compositeImage($watermark, imagick::COMPOSITE_OVER, $x, $y);
$bgframe->flattenImages();
$GIF->addImage($bgframe);
}
$GIF->writeimages($imagepath,true);

Resources