404 error when loading a image - image

I used ext js framework to build my web site. but there is alway a image that cannot be found, that means always return a 404 error. the image link is "http://localhost/undefined". I checked the HTML, and did not found any tag that its link is like this.
I wonder if I miss some steps when using the ext js framework, do any one know this issues?

have you try define the Ext blank image ??
try this :
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = '../extjs/resources/images/default/s.gif';
.....
//your code
.......
});
if still not solve.. try update your question with your current code..

Related

unable to generate PDF from spatie bowsershot

i have installed browsershot in my laravel project
I have installed puppeteer, installed chromium , my npm version is updated, but still i am unable to get the PDF of my simple html input , i have tried to take screenshot by URL method and save as image(It works), but my requirement is to generate PDF of my html.
This is my code in controller
$output=Browsershot::html($html)
->setNodeModulePath("/var/www/html/ProjectName/node_modules/")
->setChromePath("/usr/bin/chromium-browser")
->setNodeBinary('/usr/local/bin/node')
->setNpmBinary('/usr/local/bin/npm')
->showBackground()
->noSandbox()->timeout(60)
->save(public_path("DevTest.pdf");
Error Message:
"message": "The process "PATH=$PATH:/usr/local/bin NODE_PATH='/var/www/html/ProjectName/node_modules/' /usr/local/bin/node '/var/www/html/benesprint/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/1933874416-0068512001600765779\/index.html","action":"pdf","options":{"path":"\/var\/www\/html\/ProjectName\/public\/DevTest.pdf","args":["--no-sandbox"],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"executablePath":"\/usr\/bin\/chromium-browser","timeout":60000,"printBackground":true}}'" exceeded the timeout of 60 seconds.",
**i would be grateful if you can help me out.**
i have similiar problem when browsershot inside container. and my step to resolve is like this:
Manual generate PDF from html using laravel tinker. if there is an error, try reinstall chromium and puppeteer library.
If success, then try remove all css and javascript links from html, and check for the result.
If success, then add --proxy-server="direct://" and --proxy-bypass-list=* into browsershot args
If step 3 is not working, then you can put css and javascript directly into view template or using php code to inclue those files like
<?php include public_path('css/styles.css') ?>

Laravel Intervention Image: Save image directly from dropbox url

I was trying to store image from dropbox url to my local folder with laravel Intervention , but with it i am getting errors after error.
Can anyone please tell me how can i do so ?
My code is this
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0';
$filename = explode('?',basename($path))[0];
Image::make($path)->save('images/'.$filename);
The error i am getting for this is
Unable to init from given binary data.
So i tried the solution from of of stackoverflow post
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0';
$filename = explode('?',basename($path))[0];
$path = base64_decode($path);
Image::make($path)->save('images/'.$filename);
But that gave me another error.
I tried looking on goggle but i didn't find any solid answer that works for my case
Can anyone please help me on this how to download image from dropbox url and save to loacal storage ? Or do i have to add dropbox api or something??
The dropbox link that you used https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?dl=0 is a image preview page, which is not a valid image content. You can use force download mode to fetch the image content from dropbox, by editing the query parameter from ?dl=0 to ?raw=1.
$path = 'https://www.dropbox.com/s/vwswp91fiz0m1wd/1200px-Good_Food_Display_-_NCI_Visuals_Online.jpg?raw=1';
Image::make($path)->save('images/'.$filename);
See also: Force a file or folder to download, or to render on dropbox.com

blueimp jQuery-File-Upload not working for laravel 5

i am using , https://github.com/blueimp/jQuery-File-Upload plugin for image upload using ajax call in laravel 5. i also refered article http://peterjolson.com/using-laravel-and-jquery-file-upload/. but i am getting the following error error
GET http://localhost:8000/...../server/php/ 500 (Internal
Server Error)
when i use https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin i get the same error. Can anyone help with this or please suggest any working image uploader with ajax call for laravel 5
There is a main.js file, you need to adjust the url there according to the path you store it:
url: '../../uploadimage/server/php/'

image display in codeigniter shows error

I am relatively new to Codeigniter, basically I choose CakePHP to develope applications. Now I am editing a Codeigniter Project, build in version 2. I have some images in my table and I need to disply it.
I have created a helper file general_helper.php in which I have a function
function image_url(){
return base_url().'uploads/';
}
So in view page , I tried to display image by
<img src="http://localhost/myapp/uploads/vendors/images/Desert.jpg" />
My directory structure is :
myapp
-uploads
-vendors
-images
-logos
But its not showing the image ! When I tried to put the image path in the url, it shows 404 error :( whats wrong ?
Codeigniter base_url function requires folder path relative to site's base url passed as parameters. Please try use below code.
First in constructor, please load your library -
$this->load->library('general');
Then please pass your uploads directory as parameter to base_url
function image_url(){
return base_url('uploads/');
}
If images are not uploading please do check image type.
Also try use log_message('info','info_message') function to record base url.
Please refer http://www.codeigniter.com/userguide2/general/errors.html

WordPress Ajax Get Request?

I have a page that includes a php file I have written like so
HTML
<div id="playlists_div_holder">
<?php include(dirname(__FILE__) . '/includes/get_playlists.php'); ?>
</div>
I have created a button that will refresh the playlists , incase the user has uploaded (added/removed) anything, and I am trying to do so with an ajax request to get the file and include it back into that div, but I am receiving a 500 error.
I am doing this in WordPress so that may be an issue.
The Button
<span class="button-primary refresh-playlists" onclick="ReloadPlaylists()">Refresh Playlists</span>
Ajax Request
function ReloadPlaylists() {
jQuery.get('<?php echo plugins_url();?>/Player/includes/get_playlists.php', function(data) {
jQuery('#playlists_div_holder').html(data);
alert('Load was performed.');
});
}
Including it works but an ajax get throws a 500 error
It's pretty hard to guess the problem but some simple workarounds that you can use all the time:-
CAUTION! Please take backup of your WordPress before doing anything.
1st workaround:-
Download fresh WordPress copy
Delete every folder, except the wp-content folder.
Upload all the files and folders again, except the wp-content folder.
2nd workaround:-
Rename
wp-content/themes
to
wp-content/themes-backup
Create a new folder:-
wp-content/themes
start copying each theme from themes-backup to themes one by one and see if the error is gone.
Now what you have done with the themes folder, do exactly with the plugins folder.
Based on your comment,
i'm getting call to undefined function get_option on line 8 , which is odd because it works when i include it the first time. Could it be because its calling the same file on the other and it has some sort of variable conflict?
This is because when the plugin in running as an include, all the wp-includes are laoded before your plugin code is execute. However when you make an AJAX call directly to that file, the wp-includes are no loaded hence your get_option() isn't working.
You can fix that by adding include_once("../../../wp-blog-header.php"); on top of your get_playlists.php file. That might break your plugin (not sure) so in that case its safe to use it inside a condition like this
if(stristr($_SERVER["REQUEST_URI"], get_playlists.php))
include_once("../../../wp-blog-header.php");
However once you do that you will get an Error 404 when you make an AJAX request because that URL is not registered in Wordpress URL Rewrite. You can override that by using header() function.
if(stristr($_SERVER["REQUEST_URI"], get_playlists.php)) {
include_once("../../../wp-blog-header.php");
header("HTTP/1.1 200 OK");
}

Resources