Command (insert) is not available for driver (Gd) - laravel-5

Hello Im working with Image Intervention. Project working very well from local server.
My remote server Digitalocean droplet and Lamp Ubuntu 14.04 installed. Im sure all necessary modules installed and active.
GD Version => 2.1.1-dev
imagick module version => 3.1.2
PHP Version 5.5.9-1ubuntu4.21
Image::make('uploads/products/'.$filename)->fit(440, 585)->insert('uploads/watermark.png','center',0,0)->save('uploads/products/'.$filename, 100);
if ->insert function bypass my codes working on droplet. but when add to ->insert to code throwing error message.
Laravel 5.2 throw this error message: Command (insert) is not available for driver (Gd) Im trying all of my mind. how to fix this problem. I lost a one day :(

setlocale(LC_ALL, 'en_GB.UTF-8');
$file = $request->file('file');
list($filename, $extension) = explode(".", $file->getClientOriginalName());
$filename = strtolower(str_slug(uniqid().'-'.$filename).'.'.$extension);
$fileSave = $file->move('uploads/post',$filename);
Image::make('uploads/post/'.$filename)->fit(440, 585)->insert('uploads/watermark.png','center',0,0)->save('uploads/post/'.$filename, 60);
setlocale(LC_ALL, 'tr_TR.UTF-8');

I solved my problem.
I before using Turkish locale settings on server. When I set to Turkish locale settings on any Ubuntu version. All small "i" characters changing big "İ" characters. you know right classnames on Laravel Framework. Every class names starting big characters. We dont need "İ" character working with developing codes.
This problem stole 3 days from my life. I am 12 times rebuilding to server. Im happy now !

Related

Messed up file contents in vagrant smb shared file

I decided to throw up a quick OpenCart installation today using the Homestead vagrant box with Hyper-V on my Windows 10 machine, and I've got my opencart folder mapped like this in Homestead.yml:
- map: D:\web\www\oc\oc-3.0.2.0
to: /home/vagrant/code/opencart
type: "smb"
All's well. The folder is synced in the vagrant VM as expected. But on trying to install OpenCart, I get this parse error:
PHP Parse error: syntax error, unexpected ''] == '' (T_CONSTANT_ENCAPSED_STRING) in /home/vagrant/code/opencart/upload/system/startup.php on line 93
Looking at lines 92-94 of that file on my host machine:
require_once(modification(DIR_SYSTEM . 'engine/event.php'));
require_once(modification(DIR_SYSTEM . 'engine/router.php'));
require_once(modification(DIR_SYSTEM . 'engine/loader.php'));
Looking at the same lines on the synced file in vagrant:
require_once(modification(DIR_SYSTEM . 'engine/event.php'));
requirePROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
$_SERVER['HTTPS'] = true;
This code that's replaced the "require_once" code here appears earlier in this file. It's as if it's recopied over later code, making this file unusable. Here's the full file.
If I delete the lines that are copied or replace them with some other code, things appear find in the vagrant version. But if I only delete a couple of the lines, the rest still overwrite later code.
Does anyone have any idea what's causing this or how to resolve it?
So it turns out this had nothing to do with Homestead nor OpenCart. I pulled up another vagrant project I had and noticed similar problems with synced files.
I had recently installed Docker for Windows to play around with, so I decided to uninstall it and see if that would fix the problem. And it did.
So somewhere, somehow Vagrant and Docker aren't getting along on Windows 10. No idea where the exact problem is, though.

Uploading a zip file from relative directory fails on Windows using Selenium WebDriver with Ruby. It works well in Mac

We are currently working on an web application testing using Selenium-Webdriver with Ruby. Originally we only test the OSX platform, until recently we realize that Windows platform should also be tested, (IE, Firefox, Chrome, Opera). But those following lines code that work well on OSX fails on Windows(7 & 8).
I want to upload a zip file from relative directory on Windows, like "./assets/application/www.zip"
#driver.execute_script("arguments[0].style.visibility = 'visible'; arguments[0].style.width = '1px';arguments[0].style.height = '1px';arguments[0].style.opacity = 1",upload_a_zip_btn)
upload_a_zip_btn.send_keys (File.expand_path("../../assets/application/www.zip",__FILE__)) # 1
upload_a_zip_btn.send_keys ("assets\/application\/www.zip") # 2
upload_a_zip_btn.send_keys "C:\\www.zip" # 3
I tried all the 3 conditions, but only the 3rd works.
The error appeared in Browser said some error like "no attached file"
Does anyone know how to deal with such situation? Thanks

saving image from HTTP_RAW_POST_DATA does not work in MAMP

I'm using the following to upload an image from post data. it works on my server using php version: 5.2.16
When I try running the exact same script on my local server using MAMp and PHP Version 5.2.17
the file is not created.
if (isset($HTTP_RAW_POST_DATA))
{
// Get the data
$imageData=$HTTP_RAW_POST_DATA;
// Remove the headers (data:,) part.
// A real application should use them according to needs such as to check image type
$filteredData=substr($imageData, strpos($imageData, ",")+1);
// Need to decode before saving since the data we received is already base64 encoded
$unencodedData=base64_decode($filteredData);
echo "unencodedData: ".$unencodedData;
$key = microtime();
$key = md5($key);
// Save file.
$fp = fopen( '../../../uploadedImages/original/' . $key . '.jpg', 'wb' );
fwrite( $fp, $unencodedData);
fclose( $fp );
}
it looks like the post data does exist if I look at it in firebug. Any ideas why this isn't working in mamp?
Some things to try:
Check to make sure you are getting the raw data when the script is running on MAMP
Check the permissions of the directory it is trying to write to and make sure you have write access to it and apache has write access to it.
I had issues running some php modules on MAMP so I switched to using versions I installed using MacPorts. It gave me more control of extra extension I wanted to install and I got the latest versions of apache, php, and the php extensions.

Fatal error: Class 'Category' not found after PHP version upgrade

I use CodeIgniter 2.1 and my production server was updated to PHP 5.4.3-1, and the pages that uses phpactiverecord don´t show nothing and don't show any error.
In my test servers with 5.3.6 works fine.
I use the nightly build version of May 2012. I try with the older versions and stable version.
Php-activerecord don´t work fine with php 5.4.3?
EDIT: I found that my new server doesn´t have displays_errors = ON. After activate it, I see the error:
Fatal error: Class 'Category' not found in /srv/www/framework/application/controllers/categories.php on line 26
at line 26:
$data["categories"] = Category::findby($parent_id);
categories.php exists in /srv/www/framework/application/controllers/ and this works fine on PHP 5.3.6.
I need to call something more or call at a different way?
I found the solution.
This solution is for php-activerecord through the latest SPARKS version.
Debugging the autoload_function, I´ve seen that the model file was loaded with the first letter capitalized, only in PHP 5.4.3, not in 5.3.x, and the file wash´t loaded.
Find the ActiveRecord.php at
yourfolder/sparks/php-activerecord/0.0.0.2/vendor/php-activerecord
Search the function:
activerecord_autoload($class_name)
Line 49 change:
$file = $root.DS.$file_name;
for
$file = $root.DS.strtolower($file_name);
And now it works!
p.d. I have found another strange case with PHP 5.4.3 before solve this. The function parse_url() returns false if your database password has a '/' on the string. Because of this, php-activerecord could not connect to the database in the file yourfolder/sparks/php-activerecord/0.0.0.2/vendor/php-activerecord/lib/connection.php at function: file parse_connection_url().
On PHP 5.3 returns the correct array.

Zend OSX, and a "." added to context path

I downloaded and unpacked the latest version of Zend Framework, onto OSX (10.6) (am also running webserver with XAMPP, but I added the include_path change to both XAMPP and OSX path, but this is all command line so I dont think the php compiler is using the XAMPP install)
I try to create a project and get the following: (note that i am replacing part of the path with "----" just for the purpose of privacy)
sh-3.2# zf create project
testProject
Fatal error: Uncaught exception
'Zend_Exception' with message 'File "Zend/Tool/Project/Context/Zf/./AbstractClassFile.php" does not exist or class "Zend_Tool_Project_Context_Zf_._AbstractClassFile" was not found in the file' in /Volumes/----/----/z/library/Zend/Loader.php:99 Stack trace:
0 /Volumes/----/----/z/library/Zend/Tool/Project/Context/Repository.php(88):
Zend_Loader::loadClass('Zend_Tool_Proje...')
1 /Volumes/----/----/z/library/Zend/Tool/Project/Context/Repository.php(79):
Zend_Tool_Project_Context_Repository->addContextClass('Zend_Tool_Proje...')
2 /Volumes/----/----/z/library/Zend/Tool/Project/Provider/Abstract.php(87):
Zend_Tool_Project_Context_Repository->addContextsFromDirectory('/Volumes/----/...',
'Zend_Tool_Proje...')
3 /Volumes/----/----/z/library/Zend/Tool/Framework/Provider/Repository.php(187):
Zend_Tool_Project_Provider_Abstract->initialize()
4 /Volumes/----/----/z/library/Zend/Tool/Framework/Client/Abstract.php(128):
Zend_Tool_F in
/Volumes/----/----/z/library/Zend/Loader.php
on line 99 sh-3.2#
Note the period after "Context_Zf_"
I've narrowed it down to this block of code:
File: /Volumes/----/----/z/library/Zend/Tool/Project/Provider/Abstract.php
public function initialize()
{
// initialize the ZF Contexts (only once per php request)
if (!self::$_isInitialized) {
// load all base contexts ONCE
$contextRegistry = Zend_Tool_Project_Context_Repository::getInstance();
$contextRegistry->addContextsFromDirectory(
dirname(dirname(__FILE__)) . '/Context/Zf/', 'Zend_Tool_Project_Context_Zf_'
);
$contextRegistry->addContextsFromDirectory(
dirname(dirname(__FILE__)) . '/Context/Filesystem/', 'Zend_Tool_Project_Context_Filesystem_'
);
// determine if there are project specfic providers ONCE
Specifically "dirname(dirname(FILE))" is echoing as "."
if I wrap the block with an 'if (dirname(dirname(__FILE))!=".") { … } ', then I don't get that error, but I get another:
sh-3.2# zf create project testProject
An Error Has Occurred
Context by name applicationDirectory does not exist in the registry.
Zend Framework Command Line Console
Tool v1.11.3 Details for action
"Create" and provider "Project"
Project
zf create project path name-of-profile file-of-profile
I tested on my Mac and it works fine. Have you tried to restart you xampp server, I don't really know how it works as I use Apache & PHP already installed versions not a "AMP pack". Maybe it's a problem with the php.ini include_path which has not been reloaded.
It's clearly a problem with the path as it don't succeed to build the class name :
"Zend/Tool/Project/Context/Zf/./AbstractClassFile.php"
the dot should not appear here.
Can you share you PATH variable from the terminal and your include_path from your php.ini.
Sadly the solution was to install zend server community edition, and have that take care of everything for me. For anyone else on OSX going this route, check out: http://cmorrell.com/webdev/installing-zend-server-zend-framework-on-os-x-291
includes the steps for enabling CLI support.

Resources