Jump to content

Falk

Members
  • Posts

    30
  • Joined

  • Last visited

Posts posted by Falk

  1. Hi all,

    I'm trying to display a users profile image in a comments list and am not able to resize it.
    The site is used as an intranet, so there are no guest-users allowed, all users are registered with a role "staff" and have a mandatory imagefield.

    Using a multi-file image field, I tried the following code inside a function:

    // who's the author?
    $cite = $comment->getFormatted('cite');
    
    // get the author and display profile picure (first in set)
    $userImage = wire('users')->get($cite)->getUnformatted('images')->eq(0)->size(100,100)->url;

    Without resizing, everything is fine:

    // get the first image
    $userImage = wire('users')->get($cite)->getUnformatted('images')->eq(0)->url;
    
    // get the second image
    $userImage = wire('users')->get($cite)->getUnformatted('images')->eq(1)->url;

    works as expected.

    I also tried a single-file field but without success either:
    getting the original image URL works fine, resizing the image doesn’t.

     

    Any ideas on that?

  2. Hi Zeka,

    ahh, I missed the purifier! Thanks for this solution.

    After messing around with regex, I found out that this is working too:

    $content = preg_replace('/<figure[^>]*>([\s\S]*?)<\/figure[^>]*>/', '', $page->body);
    $text = $sanitizer->truncate($content, [
    	'type' => 'sentence',
    	'maxLength' => 400,
    	'visible' => true
    ]);
    echo '<p>' . $text . '</p>';

    Thanks again!

  3. Hi Forum!

    I have the following content in a ckeditor body-field:

    <figure class="align_right"><img alt="some random alt text" src="path/to/image-file" />
    <figcaption>some random caption text</figcaption>
    </figure>
    
    <p>some random text</p>

    I use 

    $text = $sanitizer->truncate($page->body, [
    	'type' => 'sentence',
    	'maxLength' => 400,
    	'visible' => true
    ]);
    $content = "<p>";
    $content .= $text;
    $content .= "</p>";
    
    echo $content;

    to output the body-field in my template, which results in…

    <p>some random caption text some random text</p>

    Is there any way to tell $sanitizer->truncate to skip/remove/ignore anything that’s inside a <figure> Tag, so that I get rid of the part "some random caption text"?

     

     

  4. Hi!

    After temporarily using Module Image Extra, which I completely removed, I had some troubles with my imagefield (unused table columns).

    So I just imported a previous version of this column via PHPmyAdmin, which worked pretty well.

    Anyways, in Processwire Backend all image tags are gone, although they are OK in the database.
    Other image related things work (thumbnail, title etc are OK).

    Is there any way to recreate all the images or something? Or may this be an cache-related issue?

     

    Thanks in advance ?

     

  5. Hi!

    I have lots of blogposts in my pagetree and I want the pagelabel to include the value of the post’s datefield (only the year).

    Adding date | title in the template settings results in something like…
    1536012000 | my blogpost title

    Is it possible to convert the timestamp to a readable date?

     

  6. Somehow it’s not working for me…

    I see a thumbnail of the image with a grey overlay and a spinner, but it’s not uploading.
    Tested with Safari, Chrome and Firefox without success. I also tested different settings for the image field, cleared cache and cookies…
    The upload process works for images that are smaller than specified.
    Attached you see a screenshot of the field settings, do I miss something?

     

    5938058905294_Bildschirmfoto2017-06-07um15_49_06.thumb.png.65d60924b905e7582951c3e531df8528.png

  7. Hi folks!

    I have a little problem with some language-alternate filefields file and file_en inside a repeaterfield.

    Some repeaters only contain geman files, others only contain english files.

    Looking at the german version, everything is fine, you see only german files.

    But looking at the english version, you see both english and german files because the default value is displayed if file_en is empty.

    Is there a way to not display the default value if file_en is empty?

    Regards,

    Falk

  8. I have a similar problem with a website I just finished. 

    Images appear in the correct directory (I see them with FTP), but they won’t get cropped or scaled and they won’t show up in frontend and backend.

    I tried some of the tips I found in the forum but nothing worked…

    Uploading PDF Files works fine, so I think it might be a problem with Scaling/Cropping images.

×
×
  • Create New...