My site is a Codeigniter with kcfinder and ckeditor, and my issue is when I try upload and load an image, this image upload correctly in an autocreated folder /assets/kcfinder/.thumbs/images/, but When I select the image from server, the URL is wrong and I can not see it. How can I set the correct path?
I thing that the problem is that you need to add the base url in your image path
base_url() . 'images/' . $img;
I have solved the problem.
In ../assets/kcfinder/config.php I changed:
'uploadURL' from "upload" to Absolute url and in
'uploadDir' from "" to "upload" and it worked!
Thanks anyway.
You can also use below code to set your KcFinder config settings:
<?php
/**
* KcFinder has a SESSION key name 'KCFINDER'
* You can use this as setup your dynamic config vales
* if you set uploadURL and uploadDir via SESSION, KcFinder ignore config.php
* to get these values and it start using SESSION values
*/
$_SESSION['KCFINDER'] = array(
'disabled' => false,
'uploadURL' => 'http://www.example.com/upload',
'uploadDir' => 'var/htdocs/www/upload'
);
More: See Link
Related
Displayed Image URL is incorrect. It should add "public/" in the url. How can I edit the url?
Instead of storing in public, I remove base directory as following:
'base_directory' => '',
'images_folder_name' => 'photos',
'files_folder_name' => 'files',
'shared_folder_name' => 'shares',
'thumb_folder_name' => 'thumbs',
And edit LfmHelpers.php under traits in line 113 as following:
$prefix = '/' . $prefix; And it works fine now.
If a UNISHARP then you need to have a look at this issue UNISHARP BUG as it suggest it is a bug.
The issue reporter find the solution by doing so
It worked after I removed the following from
vendor/unisharp/laravel-filemanager/src/views/script.blade.php
if (path.indexOf(ds) === 0) { path = path.substring(1); }
Hope it will solve yours.
I have a form with upload file option.
I get the file_path on $data uploaded by user. Now I want to use this
file_path to be the link in my anchor tag.
My problem is i can't get the correct link. it seems like that the base URL was being included in the link showed in the lower left of the screen.
I also read some post here to add "http://" before the link. but the link appeared was like this
c/xampp/htdocs/.../uploads/products/filename.pdf
no colon.
any idea on how can I access my uploaded file be access via link.
Thanks
paste this line in your /applications/config/config.php just right before
$config['base_url'] = "";
and change this to
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https://' : 'http://');
$root = $protocol.$_SERVER['HTTP_HOST'];
$root .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
$config['base_url'] = $root;
This approach makes your base_url() function returns the current host or url you are in. Even if you upload this to any server it will always return the exact url of your website.
Then you use it like this
<?= base_url('uploads/products/filename.pdf'); ?>
That's all you have to do. Hope this helps!
Here's the product page with an imagecached image: http://kmk-prof.kz/product/dx700lc
As you can see - image is not being displayed and has following url: /imagecache/catalogue/dx700lc-541a82fe99ac3.jpg
But when i try to browse that image just in my uploads folder - http://kmk-prof.kz/uploads/dx700lc-541a82fe99ac3.jpg it displays just fine.
Why could imagecache not work?
Here's the imagecache config.php:
'route' => 'imagecache',
'paths' => array(
public_path('uploads'),
),
'templates' => array(
'catalogue' => function($image) {
return $image->fit(213, 213);
},
),
It's very hard to tell you why the image is not displaying without any code.
Looking at the site, your image (in the html) is looking for a file in /imagecache/catalogue/dx700lc-541a82fe99ac3.jpg when your file is in uploads/dx700lc-541a82fe99ac3.jpg.
you can do 2 things:
change the code to load the file from uploads/dx700lc-541a82fe99ac3.jpg.
or, change your image path to /imagecache/catalogue/dx700lc-541a82fe99ac3.jpg
if you want more help, please post your code.
PS. your IMAGE URL link doesn't work ^_^
i would like to use the codeigniter session to enable kcfinder only for logged in users.
in my login controller i set the session like
$sesData = array(
'userId' => $this->input->post('username',true),
.....
'KCFINDER' => Array('disabled' => FALSE)
);
in the kcfinder config.php i have the session var as default
'_sessionVar' => &$_SESSION['KCFINDER'],
But i still can't access the finder (through ckeditor) i get "You don't have permission to browse server".
In config.php of kcfinder if i turn this
'disabled' => true,
to
'disabled' => false,
kcfinder works great but it has public access.
i found a temporary solution by setting the kcfinder session as
session_start();
$_SESSION['KCFINDER'] = array();
$_SESSION['KCFINDER']['disabled'] = false;
but i still looking for a codeigniter solution
You cannot access CI sessions outside CI. But if you use this library you can use CI session syntax and access the session info outside CI as well.
https://github.com/EllisLab/CodeIgniter/wiki/Native-session
Cheers,
Bart
Am not even sure if this can be done but...
Ive added a feed from my forums to wordpress it works great but I need it to auto add the url of the image in a custom field from the images in the post (feed) first image would be fine as its only ahve a slider
Is there any way to do this?
Details
Ok I think I did not explain this very well so made a few screen shots
This is my slider at the minute with my
This is an imported post one other feed I was using
On this image you can see the custom field (which I have to fill in after every import)
Adding the image url into the custom field
and finaly a view of the slider working
This is what am trying to do (auto) so my feed from my booru / forums / 2 other of my sites and (2 other peoples) sites make my home page on a new site
Hope this explain it alot more
This uses the external Simple Pie library built into WordPress to fetch the feed, get the image url and create a new post for each item and save the image url as a custom field.
To activate the process we have to hook into wp_cron. The code below does it daily but it would probably be better to do it weekly to prevent overlap. Some overlap will probably occur so this still needs a way to check if we have already imported the image
First we need a function to save the custom field after the post has been created. This section comes from another answer I found on WordPress Answers.
Edit:
This needs to be wrapped in a plugin to schedule the cron event and the cron event was missing the action to make it fire.
Edit:
Final version below tested and it works but the feed the OP is getting is using relative url's so the domain name needs to be added somewhere in the output code.
<?php
/*
Plugin Name: Fetch The Feed Image
Version: 0.1
Plugin URI: http://c3mdigital.com
Description: Sample plugin code to fetch feed image from rss and save it in a post
Author: Chris Olbekson
Author URI: http://c3mdigital.com
License: Unlicense For more information, please refer to <http://unlicense.org/>
*/
//Register the cron event on plugin activation and remove it on deactivation
register_activation_hook(__FILE__, 'c3m_activation_hook');
register_deactivation_hook(__FILE__, 'c3m_deactivation_hook');
add_action( 'c3m_scheduled_event', 'create_rss_feed_image_post');
function c3m_activation_hook() {
wp_schedule_event(time(), 'weekly', 'c3m_scheduled_event');
}
function c3m_deactivation_hook() {
wp_clear_scheduled_hook('c3m_scheduled_event');
}
function create_rss_feed_image_post() {
if(function_exists('fetch_feed')) {
include_once(ABSPATH . WPINC . '/feed.php'); // include the required file
$feed = fetch_feed('http://animelon.com/booru/rss/images'); // specify the source feed
}
foreach ($feed->get_items() as $item) :
// global $user_ID;
$new_post = array(
'post_title' => $item->get_title(),
'post_status' => 'published',
'post_date' => date('Y-m-d H:i:s'),
//'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);
if ($enclosure = $item->get_enclosure() )
update_post_meta( $post_id, 'feed_image_url', $enclosure->get_link() );
endforeach;
}