Forum

Thread tagged as: Question, Problem, Blog

Image path problem

I'm uploading images via the image button on CKeditor but it's incorrectly creating a path with /posts/ in front of it and also %22 at the beginning and end i.e.

/posts/%22/perch/resources/-image-name.jpg%22

This is what my .htaccess file is looking like – is there a problem here?

Redirect to PHP if it exists.

# e.g. example.com/foo will display the contents of example.com/foo.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.+)$ $1.php [L,QSA]

redirect html pages to the root domain

RewriteRule ^index.html$ / [NC,R,L]

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^posts/([a-zA-Z0-9-/]+)$ /posts/post.php?s=$1 [L] </IfModule>

Just tried adding an image to a content field on a non-blog post page all is just fine. So just a problem when it comes to blog posts.

Andrew Areoff

Andrew Areoff 0 points

  • 6 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can you post your Diagnostics Report and the template being used. You will have been asked for these when creating the post as they enable us to help you more quickly.

Diagnostics:

Perch: 2.8.13, PHP: 5.3.29, MySQL: 5.5.42, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.13), assets (2.8.13), categories (2.8.13), perch_blog (4.6) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog' ); PERCH_LOGINPATH: /perch PERCH_PATH: /home/sitename/public_html/perch PERCH_CORE: /home/sitename/public_html/perch/core PERCH_RESFILEPATH: /home/sitename/public_html/perch/resources Image manipulation: GD PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M Resource folder writeable: Yes DOCUMENT_ROOT: /home/sitename/public_html HTTP_HOST: www.sitename.com REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Template:

<div class="post"> <?php perch_blog_post(perch_get('s')); ?>

            <div class="meta">
                <div class="cats">
                    <?php perch_blog_post_categories(perch_get('s')); ?>
                </div>
                <div class="tags">
                    <?php perch_blog_post_tags(perch_get('s')); ?>
                </div>
            </div>



        </div>
Rachel Andrew

Rachel Andrew 394 points
Perch Support

That looks like your page, we need to see your template - where the Perch tags are.

Are we talking about post.html in perch_blog/templates/blog/

<article class="h-entry">

<p class="meta">
    <time class="dt-published" datetime="<perch:blog id="postDateTime" type="date" label="Date" time="true" format="Y-m-d H:i:s" divider-before="Meta information" />">
        <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" /> 
    </time>

    <perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes">
        <a href="archive.php?cat=<perch:category id="catSlug" type="slug" />" class="p-category">
            <perch:category id="catTitle" type="text" />
        </a>
    </perch:categories>

</p>
<perch:if exists="image">
    <div>
        <img src="<perch:blog id="image" type="image" width="320" height="240" crop="true" label="Image" order="4" />" alt="<perch:blog id="postTitle" />" />
    </div>
</perch:if>
<div class="description e-content">
    <perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="ckeditor" markdown="true" size="xxl autowidth" required="true" />
</div>

</article>

<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="3" suppress="true" size="s" /> <perch:blog id="image" type="image" width="50" height="50" crop="true" suppress="true" />

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Yes - you have ckeditor on your field, which is an HTML editor, but then have specified markdown="true"

You need to remove markdown="true" and add html="true" if you want to use a WYSIWYG.

As most editors create HTML you need to set html="true" on your region in addition to adding the editor attribute.

https://docs.grabaperch.com/docs/customizing-perch/installing-editors/

Ah, thanks! A simple problem hey?

On another note, CKEditor doesn't seem to let you choose an already existing image asset.

Is there another editor you have available that does that as my client will go potty trying to upload the same image each time.

Drew McLellan

Drew McLellan 2638 points
Perch Support

We don't have that option yet.

Drew McLellan said:

We don't have that option yet.

Ah, thought I'd ask incase I'm doing something wrong.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's planned for a future update, and that may include CKEditor. On the whole we'd encourage more structured ways of managing content (e.g. Blocks) and so features for WYSIWYG fall further down the list.