i am currently using laravel 4 for my project, i download a package that turns youtube/vimeo urls into embed, i required the package in my composer and run composer update.
However now i am trying to use this package but i keep getting an error:
Class 'Embed' not found
The code for this is in my helpers.php file:
function embed_video($url, $width = 0, $height = 0)
{
$embed = Embed::make($url)->parseUrl();
if ($embed) {
// Set width of the embed.
if ($width > 0)
{
$embed->setAttribute(['width' => $width]);
}
// Set height of the embed.
if ($height > 0)
{
$embed->setAttribute(['height' => $height]);
}
return $embed->getHtml();
}
}
I call this function in my view.
This is the link for the package: cohensive
Related
I have a Laravel application working on different urls. example.ch and app.example.net are working will. On the same server like app.example.net i like to run app-stage.example.net.
The application return an error 500 without an error log.
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
var_dump($kernel); // returns an object. Everything ok
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
var_dump($response) //returns error 500
I checked the php version.
I checked the fpm version.
I checked the .env file
I did "sudo chmod -R 777 bootstrap/cache storage"
I restarted the server.
I tried to show the errors.
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");
No success.
What can I do in addition to find the error?
use this package Dotenv
make a file like this
and then use multiple .env for example acceptnace.env . production.env , staging.env
make a file like environment.php in bootstrap directory like this
<?php
$envPath = realpath(dirname(__DIR__));
$env = get_current_user();
if ($env == 'staging') {
$envFile = ".staging.env";
} elseif ($env == "acceptance") {
$envFile = ".acceptance.env";
} elseif ($env == "development") {
$envFile = ".development.env";
} elseif ($env == "production") {
$envFile = ".production.env";
} elseif ($env == "beta") {
$envFile = ".beta.env";
} else {
$envFile = ".local.env";
}
Dotenv\Dotenv::create($envPath, $envFile)->load();
and this will load multiple env for your app
I am using HMVC codeigniter 3. I have a folder called admin under and in that folder I have a subfolder called client. In my config file, i have set up the module path like this;
$config['modules_locations'] = array(
APPPATH.'modules/' => '../modules/',
APPPATH.'modules/admin/' => '../modules/admin/',
);
Now, the problem is, its loadig my client controller but its not loading my entites. it is showing me the following error;
> An uncaught Exception was encountered
>
> Type: Doctrine\ORM\Query\QueryException
>
> Message: [Semantical Error] line 0, col 109 near 'entities\AppClient':
> Error: Class 'entities\AppClient' is not defined.
Please help me to solve this issue..This client module works fine, if i moved it from sub module to only modules folder
solved it...Add the following function in doctorine.php
private function _recursiveDir(&$array, $directory)
{
$scanned_dir = array_diff(scandir($directory), array('..', '.'));
sort($scanned_dir);
$subModules = array(
"admin"
);
foreach ($scanned_dir as $module) {
if (is_dir($directory.$module."/models")) {
$array[] = $directory.$module."/models/doctrine/entities";
} else if (in_array($module, $subModules)) {
$this->_recursiveDir($array, $directory.$module."/");
}
}
}
I am working on an app in Laravel which uses Intervention Image library and Imagick to upload and resize images on the fly. Following is my code:
public function saveImage($directory, $imageObject) {
$imageFile = $imageObject->store('app/'.$directory);
$filename = str_replace('app/'.$directory.'/','',$imageFile);
$imageObject = Storage::get($imageFile);
$img = Image::make($imageObject);
$img->resize(null, 40, function ($constraint) {
$constraint->aspectRatio();
});
$imageFile = $img->stream();
Storage::put('app/'.$directory.'/'.$filename, $imageFile->__toString());
// $img->save($imagePath);
return $filename;
}
However the problem occurs on the line Image::make($imageObject). The only error which Heroku returns is 503 Service Unavailable. Please help.
Imagick is a library that needs to be installed on the machine. From heroku docs:
The following built-in extensions have been built “shared” and can be
enabled through composer.json (internal identifier names given in
parentheses):
Add the code from this answer to your composer.json-https://stackoverflow.com/a/35660753/2460352:
...
"require": {
"ext-imagick": "*",
...
}
}
I wanted the Laravel 4.1 package to be at the root of a particular web server so I took it out of it's "laravel" dir and moved it.
Used to be in: C:\www\mysite.dev\laravel
Now it is in: C:\www\mysite.dev
When I run composer update it chokes producing the error:
{"error":{"type":"ErrorException","message":"mkdir(): No such file or directory","file":"C:\\www\\mysite.dev\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\Filesystem.php","line":302}}
How can I configure composer.json to compensate for this change?
It seems like problem with permissions.
Line 302 of Filesystem.php is the following (in bold):
public function makeDirectory($path, $mode = 0777, $recursive = false, $force = false)
{
if ($force)
{
return #mkdir($path, $mode, $recursive);
}
else
{
302 return mkdir($path, $mode, $recursive);
}
}
The json output is not generated by Ext getcontentbyajax in TYPO3 ver. 4.7. It invokes an 500 Internal server error. In the serverlog i found the error is in line 42 of /lib/class.tx_getcontentbyajax.php.
switch(t3lib_div::_GP('todo')){
I found a 4.7 issue on:
http://lists.typo3.org/pipermail/typo3-german/2012-September/087865.html
t3lib_div::GPvar() changes to t3lib_div::_GP()
When you change all GPvar's to _GP the extension works fine.
Here the changed method main() form /lib/class.tx_getcontentbyajax.php of getcontentbyajax extension:
public function main(){
switch(t3lib_div::_GP('todo')){
case 'pagebrowser':
$href = str_replace(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '', t3lib_div::_GP('href')); // IE6 has problems
$requestedPage = file_get_contents(urldecode(t3lib_div::getIndpEnv('TYPO3_SITE_URL') . $href));
/*preg_match('/<div.*?id\=[\"]{0,1}' . t3lib_div::GPvar('part') . '[\"]{0,1}.*?>[\r\n]{0,2}<!--ajaxreplace-->[\s]{0,}(.*?)[\s]{0,}<!--ajaxreplace-->[\r\n]{0,2}<\/div>/s', $requestedPage, $matches);*/
preg_match('/<!--ajaxreplace-->(.*?)<!--ajaxreplace-->/s', $requestedPage, $matchesContent);
preg_match('/<title>(.*?)<\/title>/s', $requestedPage, $matchesTitle);
if(array_key_exists(1, $matchesContent)){
if(array_key_exists(1, $matchesTitle)){
$this->data['title'] = $matchesTitle[1];
}
$this->data['content'] = $matchesContent[1];
$this->data['success'] = true;
} else {
$this->data['content'] = 'An error occured, please reload the site or click this link to load your desired page.';
$this->data['success'] = false;
}
// hook
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'])){
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['getcontentbyajax']['mainHook'] as $_classRef){
$_procObj = & t3lib_div::getUserObj($_classRef);
$this->data = $_procObj->extraGlobalMarkerProcessor($this, $this->data);
}
}
break;
}
echo json_encode($this->data);
}