Setting up a background image in react JS - reactjs

I have a file in my public folder of react project known as backgrund.jpg
I am trying to add it in styles.css of public folder to set it up as background image.
Here is the code for the same:
background-image:url("%PUBLIC_URL%/background.jpg");
The above code doesn't change anything however when I try:
background-image:url('https://i1.wp.com/sociallover.net/wp-content/uploads/2017/06/nature-images.png');
or
background-color: greenyellow;
both of them work perfectly. To give you a better picture, here's how the files are located:
Do let me know what exactly it is that I am doing wrong?
In the inspector I get this message:
GET http://localhost:3000/%PUBLIC_URL%/background.jpg 400 (Bad Request)
Additional things i did:
did a npm start after stopping the old server.
checked for the file name extension to ensure that my jpg matches with background.jpg.

Thanks to #Guy Incognito and #Ihor Vyspianky, I solved the problem by replacing:
background-image:url("%PUBLIC_URL%/background.jpg");
to
background-image:url("background.jpg");

Related

import image in CSS file from public folder

background-image: url('/images/img-2.jpg');
this is my code and it is still giving me a problem. the image is in public folder I also tried /img-2.jpg but it is still giving me an error. can anyone please answer this question.
Try something like this
background-image : url("../../../../public/images/urimagename.png);
for best practices use assets/images folder inside the src folder.
something like src/assets/images/allyour_Images.

Fixing 'Invalid Filename' Deploy Error in Hugo

I've deployed my Hugo website using Netlify, but after my latest changes I keep getting the same error that is as follows:
Failed during stage 'deploying site': Invalid filename 'tags/c#/page/1/index.html'. Deployed filenames cannot contain # or ? characters
I can't find any file in my repository that contains such a path and my index.html doesn't contain any of those invalid characters either. I have attempted to revert the changes but I still receive the same deployment error.
Where should I be looking in my repo files to diagnose this problem?
That is pointing to an auto-generated file that lists those pages that have 'C#' as a tag in the front matter. So look for pages that have something like:
tags: [ 'C#']
in it.
In order fix, you will need to change the tag to 'c-sharp' or something similar.
Or - check that preserveTaxonomyNames is not in your site.yml (or is set to false).
This error happens when we use C# tag or other that contains # in our post/markdown because Hugo will generate static files in public folder according to the tag such as tags/c#/index.xml.
We certainly can replace with other tag like C-Sharp or similar but if we still want to see C# tag in our post there is a workaround for that.
After replacing the tag with C-Sharp for example.
tags: ["C-Sharp"]
We need to override html file where this new tag will appear, then replace following code
{{ . }}
with
{{ replace . "-Sharp" "#" }}
Please notice we replace -Sharp with # so that C# will still appear on our post but the url will be [your-site]/tags/c-sharp/ and Hugo won't generate tags/c#/index.xml in public folder. Therefore, we can avoid the error.
This is summarized from here.

How to customize allure report title and logo

Below attached allure report image that generated via allure. Would like to customize report title and logo (image highlighted yellow) with my own title and logo instead of ALLURE REPORT and default logo. Appreciate your help.
To change the logo you should put the custom-logo-puglin into the puglins folder:
Edit the styles.css file and change the image reference to your own file.
In the jenkins to customize each project the plugins folder is placed here:
If you would like change for all the projects the folder is:
I recommend you the user manual
Title Change
I have changed the title by cloning the repository from git and built a local copy. (I am using Windows OS).
Prerequisite
Gradle Version 5.2.1-https://gradle.org/releases/
Node Js-https://nodejs.org/en/download/ -npm -6.4.1
After installing prerequisite please follow below steps
Visit https://github.com/allure-framework/allure2
Clone the repository- Link:
https://github.com/allure-framework/allure2.git
Assume the repository is saved locally under C:\allure2-2.10.0
Navigate to
C:\allure2-2.10.0\allure-generator\src\main\java\io\qameta\allure\summary
Edit SummaryPlugin.Java file with any text editor
Search for setReportName("Allure Report"); and change to whatever name
you want to give. Example setReportName("Automation Report")and save that file
Navigate to C:\allure2-2.10.0\allure-generator
Open command prompt (cmd) from this folder.Type gradle build and hit enter
Wait for few mins till it builds. It takes around 20 mins.
Navigate to c:\allure2-2.10.0\allure-generator\build\libs
Copy newly created file in build\libs folder allure-generator-2.10.0.jar file
I have installed manually from https://docs.qameta.io/allure/#_manual_installation
Navigate to allure-2.10.0\allure-2.10.0\lib and override allure-generator-2.10.0.jar file with the file created newly from the gradle build folder
Title change image screenshot
Logo Change
I have installed manually from
https://docs.qameta.io/allure/#_manual_installation
Navigate to folder allure-2.10.0\allure-2.10.0\config
With any text editor edit file named allure.yml
At the last add one more line i.e. enter code here
- custom-logo-plugin and save the file to activate the plugin. allure.yml screenshot
Navigate to allure-2.10.0\plugins\custom-logo-plugin\static edit
styles.css
.side-nav__brand {
background: url('yourlogo.svg') no-repeat left center !important;
padding-left: 180px !important;
margin-left: 10px;
}
In the same folder put your svg file or png image file
Now generate allure report.
Both title and logo will be changed according to your needs.
Hope it helps! Thanks
In the custom-logo-plugin/static/styles.css add "!important" to the background style. With that change the custom-logo-plugin should work. This replaces only the logo image.
You can also use a logo-with-text by using "display:none" to .side-nav__brand-text selector and adding a height to .side-nav__brand selector. Your logo in this case should be 170px width.
allure custom logo and report name / title plugin(s) are currently not working due to previous changes, you can achieve this goal by cloning the source, modifying it and building a local copy instead and using it until we fix such plugins or offer a new alternative.
I may answer a little late...
Concerning the report title, actually it seems to be hardcoded during the generation step.
Take a look at the files in "allure-generator/src/main/java/io/qameta/allure/summary",
especially SummaryPlugin.java
SummaryPlugin.java
A short term solution could consist in editing the file "allure-report/widgets/summary.json" between "allure generate" and "allure open".
summary.json
The long term one should be to add a parameter during the generation step.

"Undefined" Text In SuiteCRM Instance Headings

I get the following error in messages, popups, headings, titles and even the loading bar on a SuiteCRM installation:
"undefined"
in place of where the text should be.
In various SugarCRM forums it has mentioned the following:
Change permissions of cache folder to 777. --> this has been done
already
Remove the file /cache/jsLanguage/en_us.js and clear the browser
cache also. --> tried this already
Remove the cache folder by flushing the cache in Admin > Repair >
Quick Repair and Rebuild within the Sugar application. --> Tried
this already
Change the default values for dir_mode and file_mode to the
following in the file config.php. --> This has been already done
'dir_mode' => 493, // 16
'file_mode' => 420, // 164
None of these solutions seemed to work.
Screenshots:
http://imgur.com/a/6EOL1
It likely not loading the JavaScript language strings as your .htaccess is not correct, likely the URL for your instance has changed from when it was first installed.
Go into Admin->repair and select Rebuild .htaccess File

Silverlight Image Loading

I'm a beginner just beginning to work with Silverlight with a very basic question. I want to display a .png image. I have already done it in the page.xaml file but I would like to do it in code (C#) so that I can add and remove images while my program is running. I have seen some code in which you add an image to the Children of a Canvas, but when I do this no images are ever displayed. Could someone provide some code and where to put it? Here is what I've been working with. There are no exceptions, but no image appears.
page.myCanvas.Children.Add(LoadImage("Image/MrBlue"));
public Image LoadImage(string resource)
{
Image img = new Image();
Uri uri = new Uri(resource, UriKind.Relative);
ImageSource imgSrc = new System.Windows.Media.Imaging.BitmapImage(uri);
img.SetValue(Image.SourceProperty, imgSrc);
return img;
}
The image is set to "Resource" and "Do not Copy."
Debugging Silverlight can be a pain, although it's quite possible to set up in VS2008 (which you might already have done. If you haven't feel free to ask...) and that can catch some of the 'simple' errors like having the wrong Uri for the image you want. Your code looks fine to me, although what I'm using is slightly different. If you want an example from a working app, the function I use for loading images is:
public void ShowPicture(Uri location)
{
Image pic = new Image();
pic.Source = new BitmapImage(location);
Grid.SetColumn(pic, 1);
Grid.SetRow(pic, 1);
LayoutRoot.Children.Add(pic);
}
Note that I have a using statement that includes System.Windows.Media.Imaging.
Even without full debugging, a utility like fiddler that shows the http requests might help track down bad Uris in code, which is all I can think of that might be wrong here. Hope it helps.
I tested your code and it works fine for me, so as Raumornie already hinted, it would seem to most likely be an issue with the path to the image. As per your code, is the image file located in a folder called Image in your Silverlight project and just named MrBlue? On a quick look, it seems to be missing the .png, or?
Good luck!

Resources