WebGL Marker does not show custom Icon correctly - webgl-earth

The WebGL sample code to show custom markers is very simple but it does not work. I am interested in getting it to run on a local server successfully.
Here is the source:
https://examples.webglearth.com/#markers
and the line with the sample code that does not work:
var markerCustom = WE.marker([50, -9], '/img/logo-webglearth-white-100.png', 100, 24).addTo(earth);
It works perfectly on their website but not on my local server.
And here is my code:
// car location
var markerCustom = WE.marker([33.827284, -87.538893], 'images/car_west_small.png', 128, 125).addTo(earth);
No matter what I do, I always see the blue default blue marker. the file exists in the path and I tried varying the size to see if it was an issue with its size but still the same.
For another test I did, I also copied the original line and the original png to my local server.
var markerCustom = WE.marker([50, -9],'/img/logo-webglearth-white-100.png', 100, 24).addTo(earth);
I changed the Lat/Long to and the path
var markerCustom = WE.marker([33.827284, -87.538893], '/images/logo-webglearth-white-100.png', 100, 24).addTo(earth);
I made sure that http://localserver/images/logo-webglearth-white-100.png downloads the png correctly and it did.
Then I launched the page and I still got the issue.
How can I fix it?

Related

chromeless is not saving image in correct location

[OSX] [node 8.4.0] [chromeless 1.3.0]
I am trying to implement a test using chromeless. I am running the sample in a local instance, with one change of specifying the imagePath to save the image. It is running and saving an image however the image is being saved in the default location still. Any ideas on what I am doing wrong? My desire is to save the image relative to the directory the test was executed in.
Modified line below.
.screenshot({ filePath: './images/test1.png'} );
As I said it all runs but the image is still saved in the following location
/var/folders/r1/4xfjz/T/cjavyrbo70000kk.png
Looks like a known problem. See https://github.com/graphcool/chromeless/issues/282

Using Leigh version of S3Wrapper.cfc Can't get past Init

I am new to S3 and need to use it for image storage. I found a half dozen versions of an s2wrapper for cf but it appears that the only one set of for v4 is one modified by Leigh
https://gist.github.com/Leigh-/26993ed79c956c9309a9dfe40f1fce29
Dropped in the com directory and created a "test" page that contains the following code:
s3 = createObject('component','com.S3Wrapper').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);
but got the following error :
So I changed the line 37 from
variables.Sv4Util = createObject('component', 'Sv4').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);
to
variables.Sv4Util = createObject('component', 'Sv4Util').init(arguments.S3AccessKey, arguments.S3SecretAccessKey);
Now I am getting:
I feel like going through Leigh code and start changing things is a bad idea since I have lurked here for year an know Leigh's code is solid.
Does any know if there are any examples on how to use this anywhere? If not what I am doing wrong. If it makes a difference I am using Lucee 5 and not Adobe's CF engine.
UPDATE :
I followed Leigh's directions and the error is now gone. I am addedsome more code to my test page which now looks like this :
<cfscript>
s3 = createObject('component','com.S3v4').init(application.s3.AccessKeyId,application.s3.SecretAccessKey);
bucket = "imgbkt.domain.com";
obj = "fake.ping";
region = "s3-us-west-1"
test = s3.getObject(bucket,obj,region);
writeDump(test);
test2 = s3.getObjectLink(bucket,obj,region);
writeDump(test2);
writeDump(s3);
</cfscript>
Regardless of what I put in for bucket, obj or region I get :
JIC I did go to AWS and get new keys:
Leigh if you are still around or anyone how has used one of the s3Wrappers any suggestions or guidance?
UPDATE #2:
Even after Alex's help I am not able to get this to work. The Link I receive from getObjectLink is not valid and getObject never does download an object. I thought I would try the putObject method
test3 = s3.putObject(bucketName=bucket,regionName=region,keyName="favicon.ico");
writeDump(test3);
to see if there is any additional information, I received this :
I did find this article https://shlomoswidler.com/2009/08/amazon-s3-gotcha-using-virtual-host.html but it is pretty old and since S3 specifically suggests using dots in bucketnames I don't that it is relevant any longer. There is obviously something I am doing wrong but I have spent hours trying to resolve this and I can't seem to figure out what it might be.
I will give you a rundown of what the code does:
getObjectLink returns a HTTP URL for the file fake.ping that is found looking in the bucket imgbkt.domain.com of region s3-us-west-1. This link is temporary and expires after 60 seconds by default.
getObject invokes getObjectLink and immediately requests the URL using HTTP GET. The response is then saved to the directory of the S3v4.cfc with the filename fake.ping by default. Finally the function returns the full path of the downloaded file: E:\wwwDevRoot\taa\fake.ping
To save the file in a different location, you would invoke:
downloadPath = 'E:\';
test = s3.getObject(bucket,obj,region,downloadPath);
writeDump(test);
The HTTP request is synchronous, meaning the file will be downloaded completely when the functions returns the filepath.
If you want to access the actual content of the file, you can do this:
test = s3.getObject(bucket,obj,region);
contentAsString = fileRead(test); // returns the file content as string
// or
contentAsBinary = fileReadBinary(test); // returns the content as binary (byte array)
writeDump(contentAsString);
writeDump(contentAsBinary);
(You might want to stream the content if the file is large since fileRead/fileReadBinary reads the whole file into buffer. Use fileOpen to stream the content.
Does that help you?

Google Drive - use WebViewLink vs thumbnailLink

I'm using the Google Drive API where I can gain access to 2 pieces of data that I need to display a jpg file oin my program. WebViewLink is the "large" size image while thumbnailLink is the "thumb" smaller size of the same image.
I'm having an issue with downloading the WebViewLink that I do not have with the thumbnailLink. Part of my code calls either exif_imagetype($filename) or getimagesize($filename) so I can retrieve the type, height & width etc for the $filename. This is successful for the thumbnailView but not the WebViewLink...
code snippet...
$WebViewLink = "https://drive.google.com/a/treering.com/file/d/blablabla";
$type = exif_imagetype($WebViewLink);
--- results in the error
"PHP Warning: exif_imagetype(): stream does not support seeking..."
where as...
$thumbnailLink = "https://lh6.googleusercontent.com/blablabla";
$type = exif_imagetype($thumbnailLink);
--- successful
where $type = 2 // a .jpg file
Not sure what I need to do to gain a usable WebViewLink... maybe use the "export" function to copy to a file on my server that is accessible, then use that exported file for the functions that fail above?
Thanks for any help.
John
I think you are using the wrong property to get the image of the file.
WebViewLink
A link for opening the file in a relevant Google editor or viewer in a browser.
thumbnailLink
A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
You can try using the iconLink():
A static, unauthenticated link to the file's icon.
Sample image of thumbnailLink:
Sample image of a iconLink:
It will still show relevant image about the file.
Hope it helps!

FPDF Fatal Error

I am trying to test implementation of FPDF. Below is the code I'm testing with, but it keeps giving me the error: "Fatal error: Class 'FPDF' not found in /home4/fwall/public_html/create-press-release.php on line 5". That is the URL to the page I am calling the below code on.
I have verified that the php file for FPDF is being required from the right spot, and it's still happening. Can anyone figure out what's going on?
require(__DIR__.'/fpdf.php'); //The fpdf folder is in my root directory.
//create a FPDF object
$pdf=new FPDF();
//set document properties
$pdf->SetAuthor('Lana Kovacevic');
$pdf->SetTitle('FPDF tutorial');
//set font for the entire document
$pdf->SetFont('Helvetica','B',20);
$pdf->SetTextColor(50,60,100);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real,'default');
//insert an image and make it a link
//$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
//display the title with a border around it
$pdf->SetXY(50,20);
$pdf->SetDrawColor(50,60,100);
$pdf->Cell(100,10,'FPDF Tutorial',1,0,'C',0);
//Set x and y position for the main text, reduce font size and write content
$pdf->SetXY (10,50);
$pdf->SetFontSize(10);
$pdf->Write(5,'Congratulations! You have generated a PDF.');
//Output the document
$pdf->Output('example1.pdf','I');
This line:
require('http://siteurlredacted.com/fpdf/fpdf.php');
probably won't do what you expect. The request will make the remote server "execute" fpdf.php, returning a blank page, and your script will include an empty file. That is why it doesn't find any class to load.
You should download FPDF and put the file on your filesystem, where it is accesible to your script with no HTTP requests. You can try putting fpdf.php inside your project.
Hope this helps.

Jcrop and imagemagic final piece of puzzle

I have set up on client Jcrop and on Server a imagemagick (express.js).
Image is uploaded to server first, and then shown to the client. Client makes crop, and the following information is sent to server:
function showCoords(c)
{
// variables can be accessed here as
// c.x, c.y, c.x2, c.y2, c.w, c.h
};
I have the image stored on server ready to be cropped. Question is, if using imagemagick... how do I use those variables? Image magick has resize and crop (it has other options as well) that seem to be relevant... but it seems that I have more variables then the IM accepts.
What is going on?
You can ignore point2 (c.x2,x.y2). Jcrop is just being helpful by giving you a rectangles size (c.w,c.h), starting point (c.x,c.y), and ending point (c.x2,c.y2).
ImageMagick has it's own Image Geometry format, so you just need the size & offset (starting point).
function showCoords(c)
{
var IMGeometry = String.concat(c.w,"x",c.y,"+",c.x,"+",c.y);
//=> "175x125+50+50"
// Assuming you are using node-imagemagick
im.convert(["source.jpg","-crop",IMGeometry,"out.jpg"],function(err, stdout){
// Callback
});
}