Can't insert image in TinyMCE
#1
Posted 01 December 2011 - 09:31 PM
When I select an image from the tinymce editor, the image file does not appear. I have an image field that I can see those images but not the ones that were uploaded to the document field. And yes, I have allowed jpgs, etc. to be uploaded to the document field.
I don't want to upload images to the image field since I am using this field for sidebar images.
Is this a bug, am I being dumb, or is there some other way to do this?
#2
Posted 02 December 2011 - 01:19 AM
#3
Posted 02 December 2011 - 03:31 PM
When I select an image from the tinymce editor, the image file does not appear. I have an image field that I can see those images but not the ones that were uploaded to the document field. And yes, I have allowed jpgs, etc. to be uploaded to the document field.
You should be able to link to any file whether an image or not. Are you saying that you can't link to it? Or are you saying that you want to display the image itself (rather than a link to it)? If you are using the TinyMCE image insert function, it's only going to allow you to select images from a field of type 'Image', and not from a field of type 'File'. If I've understood your need correctly, I agree with Apeisa that adding another image field is the way to go.
#5
Posted 02 December 2011 - 08:10 PM
How can I get the description text to appear?
I can put this in my template, but I want this to show in my "body" field. And I want it to be exactly where it was placed in the body field.
foreach($page->body_images as $image) {
$thumb = $image;
echo "<ul>";
echo "<li>";
echo "<img src='{$thumb->url}' alt='{$thumb->description}' />";
echo "<p>$thumb->description</p>";
echo "</li>";
};
#6
Posted 05 December 2011 - 11:26 AM
<?php
function bodytext($text, $page) {
if(strpos($text, '<p>files</p>') !== false) {
$out = '';
foreach($page->files as $file) {
$out .= "<p><a class='file file_{$file->ext}' href='{$file->url}'>{$file->description}</a></p>";
}
$text = str_replace('<p>files</p>', $out, $text);
}
if(strpos($text, '<p>images</p>') !== false) {
$out = '';
foreach($page->images as $image) {
// make the image small enough to fit bodycopy column, if it's too big
if($image->width > 500) $image = $image->width(500);
$out .= "<p><img src='{$image->url}' alt='{$image->description}' /><br />{$image->description}</p>";
}
$text = str_replace('<p>images</p>', $out, $text);
}
return $text;
}
?>
<!-- later on in your code when you output the bodycopy -->
<div id='bodycopy'>
<?php echo bodytext($page->body, $page); ?>
</div>
I've done this on a couple sites now, and am thinking I should just make it a Textformatter plugin or something.
#8
Posted 12 December 2011 - 09:35 PM
Ok, so I created a body content image field, and when I use the tinymce editor, I call the image and it is placed in the appropriate field.
BUT, I want a user to be able to click on the image to link to either another page, file, or in this case to load a video.
AND, from a user standpoint it might seem a little confusing to have to type in "images" in the text editor to place an image. I think that a user would want to see that image immediately in the editor than rely on blind faith that it would appear.
#9
Posted 13 December 2011 - 09:17 AM
BUT, I want a user to be able to click on the image to link to either another page, file, or in this case to load a video.
AND, from a user standpoint it might seem a little confusing to have to type in "images" in the text editor to place an image. I think that a user would want to see that image immediately in the editor than rely on blind faith that it would appear.
The typing of "images" in a <p> was just an example of using a little template file code to automate some specific runtime output. It's not a standard or even a recommendation, just a little code snippet I found handy in a couple cases.
Unless I've misunderstood, now you are asking for exactly what the built-in functionality does– Click on the photo icon in TinyMCE and add a photo. If you then want to link it to something, then click on the photo to highlight it and then click on the link icon to select what you want it to link to.
#10
Posted 09 April 2012 - 04:40 AM
From this http://processwire.c...0270#entry10270
thanks for any eventual input,
j
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













