How to insert image in odoo 12 docker qweb report - docker

I would like to insert an image from mymodule folder but the image doesn't display. I'm using docker for this odoo.
This is my code:
<img src="/my_module/static/img/img.png" width="100%" height="100%"/>
The result is here below:
I found a similar case: https://github.com/odoo/odoo/issues/32674 but in my case, this solution is not working
Could anyone help me, please?

I solved it. Just change value on key in system parameter web.base.url to http://127.0.0.1:8069. I think this only work with docker installation.

Related

Has anyone figured out setting up custom snippets on AWS Cloud9?

I've come across a few posts online but still befuddled and nothing concrete. Maybe someone can decode the below for me, seems like they figured it out but I've never made a plugin before so not sure where to start. Maybe can outline a file structure and I can take it from there? Thanks in advance
https://community.c9.io/t/snippets-not-working-in-c9/19215/3
I could not get plugins to load using the external url method, but loading plugins locally works.
You need to create a new plugin
mkdir -p ~/.c9/plugins/myPlugin/snippets;
cd ~/.c9/plugins/myPlugin/snippets;
printf '# scope: javascript\nsnippet test\n\tif (${1:true}) {\n\t\t${2}\n\t}\n\t$0' > javascript.snippets;
echo '{"name":"myPlugin", "plugins": {}}' > ../package.json
Then open your init script (click on AWS Cloud9 > Open Your Init Script in the menu bar) and add code for loading the plugin
services["language.complete"] = services["languageComplete"];
services.pluginManager.loadPackage([
"~/.c9/plugins/myPlugin/package.json",
])
To add more snippets edit ~/.c9/plugins/myPlugin/snippets/javascript.snippets
NOTE: snippet file needs to be indented with tabs not spaces
I pieced this together from the two links below.
How to load plugins locally: https://community.c9.io/t/snippets-not-working-in-c9/19215/3
Fix for AWS not loading snippets: https://forums.aws.amazon.com/thread.jspa?threadID=299949&tstart=0

iOS: Find out if an image is used in some xib

I want to find out which images in the project are actually used. When I try to find names of images that were set programaticly, I can see them in the relevant classes when searching. This is not the case for images that were set in the xib. Is there some workaround to find if the image is used in some xib?
Try using the utility app Unused by Jeff Hodnett. I've used it before and had success with it.
You can from the command line, yes.
As always, grep is your friend:
$ cd ~Source/Books/Beginning iOS 6 Development/ch04/Control Fun/Control Fun/en.lproj
$ grep png *
BIDViewController.xib: <string key="NSResourceName">apress_logo.png</string>
BIDViewController.xib: <string key="NS.key.0">apress_logo.png</string>

nicEdit Uploading Locally - Issues with nicUpload

If anyone has managed to get locally uploading images I'd be mightily appreciative of some help.
I've downloaded the latest version of nicEdit along with the nicUpload plug in (from nicedit.com - Version 0.9 r24 released June 7th, 2012).
I've also downloaded nicUpload.php from http://svn.nicedit.com//trunk/nicUpload/php/nicUpload.php
NicUpload.php - I've set NICUPLOAD_PATH and NICUPLOAD_URI both to 'images' which is the subfolder of where nicupload.php and nicEdit.js are located.
NicEdit.js - I've added the following to line 271:-
uploadURI : 'nicUpload.php?id=123',
I've given it an ID otherwise it was failing with an invalid ID code. But the ?id=123 isn't meant to be there. I've also set the iconsPath accordingly.
Line 1370 I've switched this:-
nicURI : 'http://api.imgur.com/2/upload.json',
for this:-
nicURI : 'http://www.mydomain.com/nicedit/nicUpload.php',
But I'm still getting "Failed to upload image". I've searched and searched and searched for answers to this and I'm getting close to having spent two days tinkering with it.
With a few debugging displays I can see that it's failing on line 46 of nicUpload.php where it says:-
$file = $_FILES['nicImage'];
$image = $file['tmp_name'];
$max_upload_size = ini_max_upload_size();
if(!$file) {...
That last IF is true and that's where it exits with the error.
Appreciate anyone being able to help.
The nicUpload.php script file laying around sucks and I don't even understand how it could work.
NicEditor uses imgur as the default image upload service. The source code follows the API format described here: http://api.imgur.com/resources_anon#upload
My suggestion would be to implement the API request and response defined there.
I did not use the niceedit upload function to do what you want. I managed to add a button to the link and img dropdown menu. The button opens a file manager window where you also can upload. I managed to put then de url of the image or document into the nicedit drop down img or url window. That is how I solved the problem.

Not Identified By ImageMagick Error when there is a space in the filename

I am getting the width and height of an image stored on Amazon S3 using Paperclip as follows:
Paperclip::Geometry.from_file(user.avatar.url)
It has been working fine, but it is erroring on an image that has a space in the filename:
Paperclip::NotIdentifiedByImageMagickError: my_amazon_s3_path_is_here/Martian landslide.jpg?1294675113 is not recognized by the 'identify' command.
The image loads okay when you go to the URL in a browser. What can I do to fix this?
EDIT: Forgot to mention that images without a space in their filename work fine, so it's not an issue with Imagemagick/Paperclip setup.
Do you need to URL Encode the url's? eg replace spaces with %20
Usually when you see:
not recognized by the 'identify' command.
It means ImageMagick isn't set up correctly. Are other images working correctly?
Have you tweaked this setting yet?
Paperclip.options[:command_path] = "/opt/local/bin"
It needs to point to the location where identify is installed. From the command line, you can determine this with:
which identify
I have the same problem and file 'Снимок экрана от 2013-02-28 14:36:49.png' returns the same error. But it works correctly on heroku. So I think the problem is in ImageMagick

How can I programmatically get the image on this page?

The URL http://www.fourmilab.ch/cgi-bin/Earth shows a live map of the Earth.
If I issue this URL in my browser (FF), the image shows up just fine. But when I try 'wget' to fetch the same page, I fail!
Here's what I tried first:
wget -p http://www.fourmilab.ch/cgi-bin/Earth
Thinking, that probably all other form fields are required too, I did a 'View Source' on the above page, noted down the various field values, and then issued the following URL:
wget --post-data "opt=-p&lat=7°27'&lon=50°49'&ns=North&ew=East&alt=150889769&img=learth.evif&date=1&imgsize=320&daynight=-d" http://www.fourmilab.ch/cgi-bin/Earth
Still no image!
Can someone please tell me what is going on here...? Are there any 'gotchas' with CGI and/or form-POST based wgets? Where (book or online resource) would such concepts be explained?
If you will inspect the page's source code, there's a link with img inside, that contains the image of earth. For example:
<img
src="/cgi-bin/Earth?di=570C6ABB1F33F13E95631EFF088262D5E20F2A10190A5A599229"
ismap="ismap" usemap="#zoommap" width="320" height="320" border="0" alt="" />
Without giving the 'di' parameter, you are just asking for whole web page, with references to this image, not for the image itself.
Edit: 'Di' parameter encodes which "part" of the earth you want to receive, anyway, try for example
wget http://www.fourmilab.ch/cgi-bin/Earth?di=F5AEC312B69A58973CCAB756A12BCB7C47A9BE99E3DDC5F63DF746B66C122E4E4B28ADC1EFADCC43752B45ABE2585A62E6FB304ACB6354E2796D9D3CEF7A1044FA32907855BA5C8F
Use GET instead of POST. They're completely different for the CGI program in the background.
Following on from Ravadre,
wget -p http://www.fourmilab.ch/cgi-bin/Earth
downloads an XHTML file which contain an <img> tag.
I edited the XHTML to remove everything but the img tag and turned it into a bash script containing another wget -p command, escaping the ? and =
When I executed this I got a 14kB file which I renamed earth.jpg
Not really programmatic, the way I did it, but I think it could be done.
But as #somedeveloper said, the di value is changing (since it depends on time).
Guys, here's what I finally did. Not fully happy with this solution, as I was (and am still) hoping for a better way... one that gets the image on the first wget itself... giving me the same user experience I get when browsing via firefox.
#!/bin/bash
tmpf=/tmp/delme.jpeg
base=http://www.fourmilab.ch
liveurl=$(wget -O - $base/cgi-bin/Earth?opt=-p 2>/dev/null | perl -0777 -nle 'if(m#<img \s+ src \s* = \s* "(/cgi-bin/Earth\?di= .*? )" #gsix) { print "$1\n" }' )
wget -O $tmpf $base/$liveurl &>/dev/null
What you are downloading is the whole HTML page and not the image. To download the image and other elements too, you'll need to use the --page-requisites (and possibly --convert-links) parameter(s). Unfortunately because robots.txt disallows access to URLs under /cgi-bin/, wget will not download the image which is located under /cgi-bin/. AFAIK there's no parameter to disable the robots protocol.

Resources