Hide graphics using ArcGIS JS API 4.7 - graphic

With ArcGIS JS API 4.7, is there a way to show/hide graphics per attribute?
There is a property for the graphics called visible, but when I do set it to false myGraphic.visible = false no change occurs.
Any ideas? Thank you.

Can you share an example that reproduces your issue. I just did a test, and I do not see any problem with graphic visibility in v4.7.
Here is an example plunkr:
Live example: Plunker
`function changeGraphicVisibility() {
polygonGraphic.visible = !polygonGraphic.visible;
var spanElement = document.getElementById("visibility");
spanElement.innerHTML = polygonGraphic.visible;
}....`

Related

mapbox mapID not working?

I've just started looking at mapbox, and I've run into an issue straight away.
I've copied the sample here;
https://www.mapbox.com/mapbox.js/example/v1.0.0/
Please note this part;
<script>
L.mapbox.accessToken = 'pk.eyJ1IjoibWF1cmljZXdhbG1zbGV5IiwiYSI6ImNpbmxiZjc4djB5cjJ0dG0zejZjZHZxdjEifQ.CJHrqKevqria7ZbVMOMD5Q';
var map = L.mapbox.map('map', 'mapbox.streets')
.setView([40, -74.50], 9);
</script>
Un-editted it works in my webpage.
If I change the accessToken to my one, it works.
If I then change the mapID, though, from "mapbox.streets" to "myusername.mapID" (I've double checked these, they are correct) all I get is an empty map.
Any idea what I'm doing wrong?
This is probably what you are looking for — Add styles made with Mapbox Studio using styleLayer
Also, Check your Browsers console. In Firefox, I got the following error in the console
Error: Styles created with Mapbox Studio need to be
used with L.mapbox.styleLayer, not L.mapbox.tileLayer

Is this text overlay done using Facebook Open Graph?

Hello all,
I checked the source code of this blog post and the open graph images tags do not include the text that I've highlighted in the screen shot. Is there a special open graph tag to add text overlays? Or is it done in a different way?
Here's the link to the blog post: http://www.barakabits.com/2014/04/meet-woman-behind-e-middle-east
Thanks in advance!
Waleed
Take a look at these api links, looks like it's what you need.
https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-image-overlay-spec/
https://developers.facebook.com/docs/marketing-api/reference/ad-creative-link-data-image-layer-spec/
Facebook does not provide an option for this feature yet.
You can use PHP GD Library functions to prepare and use open graph images with an overlay.
To get an output like the screenshot you provided, you need a source image and a transparent overlay image. Then merge them together to the final open graph image.
For that you need imagecopy() function.
<?php
$src = imagecreatefromjpg('source-image.jpg');
$overlay = imagecreatefrompng('transparent-overlay.png');
$overlay_x = 0; // The position of overlay in X axis
$overlay_y = 480; // The position of overlay in Y axis
$overlay_width = 1200;
$overlay_height = 630;
imagecopy($src, $addition, $addtion_x, $addition_y, 0, 0, $overlay_width, $overlay_height);
header('Content-Type: image/png');
imagepng($src);
// Free up the memory
imagedestroy($src);
imagedestroy($overlay);
?>
If you want to use this feature on a WordPress website (like the source website you mentioned) you can follow this tutorial.
https://itsmereal.com/automated-open-graph-image-overlay-for-wordpress
or use this plugin from Github
https://github.com/itsmereal/og-image-overlay

Resize by default TinyMCE

I'm using TinyMCE for the first time, and I love it, but is a bit closed.
I'd like to get images resized by default, this is, when adding an image, put it by default on 300px width, for example (then the user can make it bigger or smaller dragging).
I don't know where to touch! Is there a command within the lists of images (the js you can attach to make TinyMCE show a list of images)? Or I have to hack css? Or I have to dive into TinyMCE code?
Thank you in advance
Marc
If you are OK with changing code files then proceed as follows
Open tiny_mce/plugins/advimage/js/image.js
Locate insertAndClose : function()
Insert after
var ed = tinyMCEPopup.editor, ......;
if(f.width.value == ""){
f.width.value = 300;
}
Hope it helps!
There are several options. I would go the css way. Check out the tinycme init configuration setting content_css. Using an additioanl own css file enables you to setthe width of images to 300px easily.

Jquery img preload not working in FireFox

I recently did a small jQuery snippet that allows me to show a loading img until the real image is loaded.
The snippet seems to work in Safari, Chrome but not FireFox.
FireFox only displays a loading alt and never switches to the loaded image.
Here is the snippet
var loading = $('<img src="/media/ajax-loader.gif" alt="loading" />');
$('.thumbnail').each(function(){
var loadIMG = loading.clone();
$(this).after(loadIMG).load(function(){
$(this).fadeIn('fast');
loadIMG.hide();
}).hide();
});
Any ideas why?
You haven't said what exactly is happing on FF but below can be one of the problem. From jquery documentation
It is possible that the load event
will not be triggered if the image is
loaded from the browser cache. To
account for this possibility, we can
use a special load event that fires
immediately if the image is ready.
event.special.load is currently
available as a plugin.
Here's the link for plugin.
Edit:
Based on comments from load event, try below:
$('.thumbnail').each(function(){
var loadIMG = loading.clone();
$(this).after(loadIMG).load(function(){
$(this).fadeIn('fast');
loadIMG.hide();
}).hide();
if (this.complete) $(this).trigger("load");
});
Of course, the plug-in seems to be doing same thing along with handling some other scenarios as well as.

iphone detect new style sheet

I am trying to trouble shoot a css issue that is appearing only in iphone browsers. I simply need to detect if the user is using an iphone, and if so, render a modified version of the div that is being affected.
I am happy to just call this modified version of the css div in the header as it will save having a second style sheet.
You used to be able to do it between browsers. It was especially good when rendering a IE6 fix.
Thanks for your help in advanced.
James
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
// do something
}