When i upload any image for my Opencart 3 website, it takes close to 10 minutes for the image to appear in the image manager.
I discovered that the images are stuck in the cache before they upload to the main directory.
I have increased the values of my php.ini and the sizes of my images are between 25kb to 50kb and deployed many speed optimization apps and yet I still have the same delays.
Presently, I want to disconnect the cache from the image manager so all images gets loaded directly to the image manager
Please I need help
A simple way to do this is to change how the Model returns files to the front-end in \catalog\model\tool\image.php right at the bottom of the file you'll find this code:
if ($this->request->server['HTTPS']) {
return $this->config->get('config_ssl') . 'image/' . $image_new;
} else {
return $this->config->get('config_url') . 'image/' . $image_new;
}
You can change it to:
if ($this->request->server['HTTPS']) {
return $this->config->get('config_ssl') . 'image/' . $image_old;
} else {
return $this->config->get('config_url') . 'image/' . $image_old;
}
Related
I want to publish with the command
quarto::quarto_publish_site()
my book-website.
The book-website is already setup on quarto-pub. If I don't add any image as a web link, the website runs and can be uploaded.
Now I add any image as a weblink, this is a exemplary code
![](https://www.website.com/wp-content/uploads/sites/2/2022/04/picture.jpg)
When I render it locally, it works. When I launch the command to publish it
compilation failed- error Unable to load picture or PDF file 'https://www.website.com/wp-content/uploads/sites/2/2022/04/picture.jpg'.
The publishing process is interrupted after this error. This is exactly the same if I launch the command from Terminal.
Is this intended to prevent to publish on quarto-pub links from other websites?
Or I can do something to avoid to download all these pics?
Including images via URL is not supposed to work for PDF output, which is not a Quarto issue but comes from how Pandoc translates !()[] to LaTeX.
Instead, you could automatically generate a local copy of the file (if not available) and then include the image in an R code chunk like this:
```{r, echo=FALSE, fig.cap='Kid', dpi=100}
if(!file.exists("kid.jpg")) {
download.file(
url = "https://edit.co.uk/uploads/2016/12/Image-1-Alternatives-to-stock-photography-Thinkstock.jpg",
destfile = "kid.jpg",
mode = "auto")
}
knitr::include_graphics("kid.jpg")
```
(of course, including the image via !()["kid.jpg"] at different location will work too once the file exists locally.)
I know how to use GraphicsMagick to make a thumbnail of the first page of a pdf if I have a pdf file and am running gm locally. I can just do this:
gm(pdfFileName + "[0]")
.background("white")
.flatten()
.resize(200, 200)
.write("output.jpg", (err, res) => {
if (err) console.log(err);
});
If I have a file called doc.pdf then passing doc.pdf[0] to gm works beautifully.
But my problem is I am generating thumbnails on an AWS Lambda function, and the Lambda takes as input data streamed from a source S3 bucket. The relevant slice of my lambda looks like this:
// Download the image from S3, transform, and upload to a different S3 bucket.
async.waterfall([
function download(next) {
s3.getObject({
Bucket: sourceBucket,
Key: sourceKey
},
next);
},
function transform(response, next) {
gm(response.Body).size(function(err, size) { // <--- gm USED HERE
.
.
.
Everything works, but for multipage pdfs, gm is generating a thumbnail from the last page of the pdf. How do I get the [0] in there? I did not see a page selector in the gm documentation as all their examples used filenames, not streams I believe there should be an API, but I have not found one.
(Note: the [0] is really important not only because the last page of multipage PDFs are sometimes blank, but I noticed when running gm on the command line with large pdfs, the [0] returns very quickly while without the [0] the whole pdf is scanned. On AWS Lambda, it's important to finish quickly to save on resources and avoid timeouts!)
You can use .selectFrame() method, which is equivalent to specifying [0] directly in file name.
In your code:
function transform(response, next) {
gm(response.Body)
.selectFrame(0) // <--- select the first page
.size(function(err, size) {
.
.
.
Don't get confused about the name of function. It work not only with frames for GIFs, but also works just fine with pages for PDFs.
Checkout this function source on GitHub.
Credits to #BenFortune for his answer to similar question about GIFs first frame. I've took it as inspiration and tested this solution with PDFs, it actually works.
Hope it helps.
Im currently working with Ionic 2.0.0-beta.32. After some searching around, I found the following code to add images to my project then at build time have them auto import into the final build
I add a directory in app called img, and place all my images in there, then the code in the gulpfile is as follows
gulp.task('images', function() {
return gulp.src(['app/img/*'])
.pipe(gulp.dest('www/build/img'));
});
and also all the runSequences
runSequence(
['images', 'sass', 'html', 'fonts', 'scripts'],
This all works good and moves the images to the www at build time, but when i run
ionic serve --lab
none of the images show, I've tried using the following
../img/imgname
/img/imgname
img/imgname
build/img/imgname
None of the above shows my image.
Any help would be great, im pulling out my hair here
Do you want to use Gulp to modify your images (i.e., reduce their sizes) or something like that? If the answer is no, then you don't need to add that task to your gulp file
gulp.task('images', function() {
return gulp.src(['app/img/*'])
.pipe(gulp.dest('www/build/img'));
});
Why? Because if the image won't be changed, it doesn't make sense that each time that you run your tasks, the images gets copied again and again (without changes).
A simple way to work with images would be to put your images in a www\images folder, and then reference them in your code like this:
<img src="images/myImage.png" />
Since they're in the www folder, they're not going to be deleted (which happens if you place them in the build folder of your app).
Hi I'm relatively new to python and DJANGO and was wondering if there was a way to load a webpage from a currently loaded webpage after a time delay
For example i have 5 or 6 graphs/charts on separate pages within my django project and want them to be displayed for 5-10 seconds then switch to the next one
I may be just missing something simple here but any help would be appreciated
If you expect them to submit the form within 30 seconds then a meta-refresh is quite a simple way to achieve that.
Otherwise you can use a javascript redirect that fires after a delay. The redirect would check that no action (such as filling out the fields) has been performed during the delay. Something like:
setTimeout(function() {
if (noChange) {
window.location = "http://www.yoururl.com";
}
}, 30 * 1000);
You should use javascript to do that:
$(function(){
setTimeout(checkUserStatus, 30000);
})
function checkUserStatus(){
//Code to check if user hit/click anything
//if yes clear TimeInterval and do the operation
//If no clear Time Interval and redirect to home page
}
I am trying to integrate facebook sdk in my unity android game. I can not find FBUtil and GameStateManager in SDK downloaded from developer site.
I got the userId using FB.UserId. Also got the response
"sending to Unity OnInitComplete({"access_token":"CAAUCMHNGlZCcBAHJBQAs7AoJNevkZAFbkpSRk60TURemvv4Y6IOu9NXjGcFjFRZAx9RoxwKT4ZBZASs0NLiYTmi4rl7RyWYdtxxhlKkSjoIWiqqDSBdSDKk0OppB2ZB4U6IgtqQs9PM8uNCaNF5xgqWn2c9DDkp4dJc9p38XONKpdwRF7qDHtM","user_id":"100003735696788","opened":true})"
Just after that when I tried to get profile picture of the user, using the code given on developer.facebook.com,
void LoginCallback() {
FB.API (
"/me/picture",
Facebook.HttpMethod.GET,
APICallback
);
}
The response I get is 4 question marks.
????
where is the problem? Please help..
I used this link using WWW in Unity and it worked well.. This is exactly what I did
Once you have the user id, create a WWW object like this:
WWW url = new WWW("http://graph.facebook.com/INSERT_USER_ID_HERE/picture?type=large");
Then in the LateUpdate I put an IF condition checking if the picture was loaded or not with a bool called loaded to avoid reloading the picture more than once
if (url.isDone && !loaded)
{
loaded = true;
Texture2D textFb2 = new Texture2D(50, 50, TextureFormat.ARGB32, false); //TextureFormat must be DXT5
url.LoadImageIntoTexture(textFb2);
PLANE_OR_QUAD_OBJECT.renderer.material.mainTexture = textFb2;
}
NOTE: url is visible in the whole class as well as loaded
If you need further help with this, let me know!
Normally Facebook picture API should return data with Texture type NOT text
For example, If you use code like #jkgm777 answer,
WWW url = new WWW("http://graph.facebook.com/INSERT_USER_ID_HERE/picture");
You should get Texture type that can use to replace your texture object in scene.
But If you want to get image url, USE THIS
http://graph.facebook.com/INSERT_USER_ID_HERE/picture?redirect=false
You will get this JSON for response
data: {
url: "{#IMAGE_URL#}",
is_silhouette: false
}