Drupal 7 - image module and contrib module - drupal

I wrote a module with "image" in dependecies. But I can't use the functions in image.gd.php
Apache log:
Call to undefined function image_gd_save()
Can you help me?

If you're doing this outside of the normal operation of the image/system modules you'll need to make sure the relevant file is included first:
module_load_include('inc', 'system', 'image.gd');

Related

Laravel scss npm run dev - Can't resolve '../images/bg-main.png'

I have Laravel project and I want to generate css file from scss. My webpack.mix.js file looks like this:
mix.sass('resources/assets/sass/style.scss', 'public/css/style.css');
when I run command npm run dev I have error:
ERROR in ./resources/assets/sass/style.scss
Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve '../images/bg-main.png' in '/var/www/html/bitpay/resources/assets/sass'
ERROR in ./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--4-4!./node_modules/sass-loader/lib/loader.js??ref--4-5!./resources/assets/sass/style.scss
Module not found: Error: Can't resolve '../images/bg-main.png' in '/var/www/html/bitpay/resources/assets/sass'
# ./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--4-4!./node_modules/sass-loader/lib/loader.js??ref--4-5!./resources/assets/sass/style.scss 7:14663-14695
# ./resources/assets/sass/style.scss
# multi ./node_modules/laravel-mix/src/builder/mock-entry.js ./resources/assets/sass/style.scss
ERROR in ./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--4-4!./node_modules/sass-loader/lib/loader.js??ref--4-5!./resources/assets/sass/style.scss
Module not found: Error: Can't resolve '../images/bg-recommendations.png' in '/var/www/html/bitpay/resources/assets/sass'
# ./node_modules/css-loader??ref--4-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--4-4!./node_modules/sass-loader/lib/loader.js??ref--4-5!./resources/assets/sass/style.scss 7:17599-17642 7:22181-22224
# ./resources/assets/sass/style.scss
# multi ./node_modules/laravel-mix/src/builder/mock-entry.js ./resources/assets/sass/style.scss
How to add images folder to compilation?
The problem is that mix cannot find the image bg-main.png that you are referring to inside style.scss.
You can either add the mix option not to process css urls as shown here:
mix.options({
processCssUrls: false
});
That has some consequences:
mix will not check for the image's existence.
mix will not automatically copy the image to the public directory.
The better solution is to place the image where mix expects it: mix expects ../images/bg-main.png to be inside directory resources/images/
References:
https://laravel-mix.com/docs/6.0/url-rewriting
https://laravel-mix.com/docs/6.0/faq#why-is-it-saying-that-an-image-in-my-css-file-cant-be-found-in-node_modules
That image files maybe not exist.
It is an incorrect path error, you used ./images/bg-main.png somewhere in your CSS. So locate that instance and change the path thus background-image:url('~/images/bg-main.png');

Laravel 5.7: what is the meaning of Undefined index style(mix('/css/frontend.css'))?

I am new to Laravel and currently attempt to import vue to my Laravel project.
After I ran 'npm run dev' command and check a page built with blade layout which is downloaded from a boilerplate project, I see the error : Undefined index in style(mix('/css/frontend.css')). This css file exists in public/css.
This is the line that invokes this error.
{{ style(mix('/css/frontend.css')) }}
What is its meaning and how to fix it?
Also, I can't find the api documentation that tell the function of style() and mix().
If you know where the documentation is, please give me the link. Thanks!
Check webpack.mix.js to see if frontend.css is being compiled by Laravel Mix. If you don't see any reference to it, then you should reference the file in your Blade views with asset('/css/frontend.css') instead of mix().
mix() reads from public/mix-manifest.json to map your source filenames to their output name, which is useful when files are versioned for cache busting. A mix-manifest entry might look like this: "/css/app.css": "/css/app.css?id=7564ad125f69af0035c3". If your file wasn't compiled or copied with Laravel mix then it would not have an entry in mix-manifest.json, which would explain the undefined index error and why you need to use asset() instead.
Also, I don't know what style() is but it doesn't come with the Laravel framework.
Refs: https://laravel.com/docs/5.7/mix#versioning-and-cache-busting

Webpack-Dev-Server giving error 'You may need an appropriate loader to handle this file type' for .jsx file

I am using the grunt-webpack. Trying to start the webpack-dev-server gives this error
Module parse failed: /u/saxenat/react-blueprint/src/js/app.jsx Unexpected token (5:16)
You may need an appropriate loader to handle this file type.
Before you close this question, let me just say: webpack is bundling the files properly. The grunt-webpack plugin provides 2 tasks: grunt-webpack and grunt-webpack-dev-server. When I try HMR with the server, it is failing. Otherwise it works fine.
I have included babel-loader with presets es-2015 and react.
Any ideas?

Meteor package: no such template

I'm writing an internal package in my Meteor app, and I cannot seem to get it to expose the packages templates to the rest of the app.
In my package.js file I have the following:
api.use(['templating', 'spacebars', 'ui'], 'client');
api.addFiles([
'client/templates/notifications/notifications.html',
'client/templates/notifications/notifications.js',
'notify.js',
'lib/collections/notifications.js'
], 'client');
and in notifications.html I have
<template name="notifications">
...
</template>
Back in the rest of the app, I have a layout.html template which simply uses the template like {{> notifications}}. But this causes the error:
Exception from Tracker recompute function: Error: No such template: notifications
at Blaze.View.lookup (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2809:15)
at null.<anonymous> (http://localhost:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:71:23)
at http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1808:16
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2043:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1807:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:296:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:214:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?517c8fe8ed6408951a30941e64a5383a7174bcfa:487:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1806:19)
at null.<anonymous> (http://localhost:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:70:10)
Any help would be appreciated.
Hard to tell without having a repo to reproduce, but here's an idea: rubaxa:sortable is a package I wrote that exposes a template successfully. Try to see what's different in yours.
BTW, you only need to api.use('templating'). No need for 'spacebars' and 'ui' just to expose a template. You may need additional functionality though.
As I can't comment yet, I write here the answer from #saimeunt :
Have you actually added the package to the app ? I know this is kinda
silly but even if the package lives under the application packages/
directory you still have to meteor add it.
Go in packages directory and run :
meteor add <YOUR_PACKAGE>
It solved the issue.
Thank you #saimeunt !

Updating to Meteor 0.9.1 woes (broke the app big time)

I’ve had some serious problems after updating meteor to 0.9.1.
Here are some example errors from the console.
Uncaught TypeError: undefined is not a function -- in dynamic_template.js
Uncaught TypeError: Cannot read property ‘prototype’ of undefined -- in helpers.js
Uncaught TypeError: undefined is not a function -- in router.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in iron-router-progress.js
Uncaught TypeError: Cannot read property ‘RouteController’ of undefined -- in global-imports.js
And dozens of: Uncaught ReferenceError: Template is not defined -- in client view js files, both the hard copies that I have created and the apparently ephemeral files that meteor apparently creates on the fly.
And fewer dozens of: Uncaught ReferenceError: Meteor is not defined -- in the same kind of files.
And one: Uncaught ReferenceError: Spacebars is not defined -- in login_buttons_dialogs.html
And about 10 sockjs errors on GET — net:ERR_CONNECTION_REFUSED
I can’t help thinking that either something very basic was not accomplished during the update procedure or there are some very basic and widespread changes that need to be made in my code in order for it to run 0.9.1.
I’m building a app that is an extension and morph of the microscope app. It's not rocket science at this point. It was working last night before the update. It was 0.9.0.1 before the update.
All help and insight is appreciated.
Thanks for the guidance. All seems to be well now. This is what I did:
I created a new meteor app, removed 2 default packages, then added:
bootstrap
iron:router
mrt:accounts-ui-bootstrap-dropdown
accounts-password
mrt:iron-router-progress
sacha:spin
Then I copied my files from the broken app to the new app and viola', everything worked.
I see that the directory structure and its naming conventions have changed, colons in place of dashes in a few spaces and the direcory or namespace prefixes such as mrt, iron, and sacha.
Here's an unexpected thing. I previously had a folder called packages in which there was a folder for each package containing all its files. Now that folder is empty, but everything is still working. I'm clearly under informed about a few things.
Again, thanks for the guidance. Even though this was a pain, I see that the resulting changes needed to happen.
Best, Alex
Many packages are breaking on Meteor#0.9.1, I suggest you create a new Meteor app like so:
$ meteor create --release 0.9.0 app
$ cd app
$ meteor remove insecure
$ meteor remove autopublish
and then add all the packages you need with meteor add packagename and copy over all the files from your app.
Stick with Meteor#0.9.0 until you know you can safely upgrade!

Resources