Support » Plugin: Add Watermarks » New Uploaded Pics are not show anymore WP4.5

  • Hello

    I have updated WP to Version 4.5 and if i activate your plugin the Pictures i upload new are only show as brocen Pic. (In Media Gallery)

    Did you have any workaround?

    Ich habe WP zur Version 4.5 aktualisiert und nun werden alle Bilder beim Raufladen in der Medienüberisicht als defekte Bilder angezeigt.

    Wenn ich dein Plugin deaktiviere funktioniert alles wieder 🙂

    hättest du dazu ein Workaraound?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Michael Zangl


    I have not tested WordPress 4.5 yet. My sites are still waiting a bit with the update.

    When I do (probrably next week), I’ll update the plugin.

    Plugin Author Michael Zangl



    My sites are running WordPress 4.5 for some time now, no compatibility issues.

    Do you have more diagnostic information? Any error message or any plugin that might be conflicting?

    I can confirm that “add watermarks” is working after uploading new images on wp4.5, although i experience problems with blog post images that are not shown in my theme (404).
    couldn’t trace it down yet, but all i can see is, that it is retina related..
    it’s a resized image that is available as retina aside to the “normal” resize. ( best to see with chrome, while ff doesn’t show the broken image)

    ok, here what i found after deleting one of the images and doing a fresh upload:
    in upload dir:
    -rw-r–r– 1 x x 10609 Apr 24 12:56 Nacht2a-30x30cm-150×150.jpg
    -rw-r–r– 1 x x 17610 Apr 24 12:56 Nacht2a-30x30cm-300×132.jpg
    -rw-r–r– 1 x x 30488 Apr 24 13:02 Nacht2a-30x30cm-320×202.jpg
    -rw-r–r– 1 x x 397980 Apr 24 13:09 Nacht2a-30x30cm-798×351@2x.jpg
    -rw-r–r– 1 x x 118224 Apr 24 13:09 Nacht2a-30x30cm-798×351.jpg
    -rw-r–r– 1 x x 147688 Apr 24 13:01 Nacht2a-30x30cm-850×374.jpg
    -rw-r–r– 1 x x 137957 Apr 24 12:56 Nacht2a-30x30cm.jpg

    in add_watermark cache:
    -rw-r–r– 1 x x 6844 Apr 24 13:01 Nacht2a-30x30cm-150×150.jpg
    -rw-r–r– 1 x x 10891 Apr 24 13:01 Nacht2a-30x30cm-300×132.jpg
    -rw-r–r– 1 x x 19673 Apr 24 13:02 Nacht2a-30x30cm-320×202.jpg
    -rw-r–r– 1 x x 105138 Apr 24 13:01 Nacht2a-30x30cm-850×374.jpg
    -rw-r–r– 1 x x 108108 Apr 24 12:58 Nacht2a-30x30cm.jpg

    Nacht2a-30x30cm-798×351@2x.jpg and Nacht2a-30x30cm-798×351.jpg are somehow not handled. they show up as broken images

    another hint for you 😉
    just remember that i had an image (resizes) not watermarked because of the image name… look at this:×50/ click on image and failure all good

    Plugin Author Michael Zangl


    Which plugin is generating those images?

    WordPress stores a list of thumbnails for images. Those images do not seem to be in that list the normal way. This is why the watermark plugin cannot find out what to do with them (watermark or not)

    the avada theme is creating them. there are a lot of other resizes that are handled fine by add_watermark like this one for example:
    listing of add_watermark cache:
    ls -l ../02/gedanken2*
    -rw-r–r– 1 x x 5518 Apr 19 13:55 ../02/gedanken2-30x30cm-150×150.jpg
    -rw-r–r– 1 x x 14951 Apr 19 13:56 ../02/gedanken2-30x30cm-300×214.jpg
    -rw-r–r– 1 x x 19976 Apr 24 10:13 ../02/gedanken2-30x30cm-300×300.jpg
    -rw-r–r– 1 x x 29692 Apr 24 10:12 ../02/gedanken2-30x30cm-460×295.jpg
    -rw-r–r– 1 x x 1510 Apr 19 13:56 ../02/gedanken2-30x30cm-66×66.jpg
    -rw-r–r– 1 x x 142678 Apr 19 13:56 ../02/gedanken2-30x30cm.jpg
    i still assume that this is related to the naming of those images. in the “tolles-bild” example above add_watermark fails to handle the fullsize image called “tolles-bild-50×50.jpg” while that one with appended “cm” is working fine. those @2x images might have the same reason for a failure.

    maybe we should open a new topic.
    i think what we are discussing now is not a strickt WP4.5 related topic. i have seen that the initiator of this topic has a watermark in his images meanwhile…. but it is up to you michael.

    Hello @michaelzangl

    hmm i have still the same problem and no error Messages.

    Maybe u can write me a Mail and i give u a Login to my Website?


    Hi Michael,
    were you able to reproduce the “tolles-bild” example issue?

    Plugin Author Michael Zangl


    No, I was not. I do not have any sites using the avada theme.

    i was digging around a bit this morning…

    for me it looks like some mismatch in function getPaths() of your plugin.

    for the example problem, where the uploaded file was called “tolles-bild-50×50.jpg, it seems that WP strips “50×50”:
    Array ( [thumbfile] => tolles-bild-50×50.jpg [attachmentfile] => tolles-bild.jpg [thumbupload] => 2016/04/tolles-bild-50×50.jpg [attachmentupload] => 2016/04/tolles-bild.jpg [thumbabs] => /bla/bla/bla/bla/bla/wp-content/uploads/2016/04/tolles-bild-50×50.jpg )

    couldn’t dive deep enough to understand all your coding…
    either that regex is too strict, or you pick up the wrong elements in the array… 🙂

    Paths found for the image: Array ( [thumbfile] => Nacht2a-30x30cm-798×351@2x.jpg [attachmentfile] => Nacht2a-30x30cm-798×351@2x.jpg [thumbupload] => 2016/04/Nacht2a-30x30cm-798×351@2x.jpg [attachmentupload] => 2016/04/Nacht2a-30x30cm-798×351@2x.jpg [thumbabs] => /…./wp-content/uploads/2016/04/Nacht2a-30x30cm-798×351@2x.jpg ) Wrong number of attachments: Array ( ) #0 AddWatermarkRequest->error404() called at [/…./wp-content/plugins/add-watermark/add-watermark.php:755] #1 AddWatermarkRequest->searchAttachments() called at [/…./wp-content/plugins/add-watermark/add-watermark.php:643] #2 AddWatermarkRequest::runAjax() called at [/…./wp-includes/plugin.php:525] #3 do_action(wp_ajax_watermark_image) called at [/…./wp-admin/admin-ajax.php:89]

    ..and this file exists: [thumbabs] => /…./wp-content/uploads/2016/04/Nacht2a-30x30cm-798×351@2x.jpg
    as well as this one:
    [thumbabs] => /bla/bla/bla/bla/bla/wp-content/uploads/2016/04/tolles-bild-50×50.jpg

    Plugin Author Michael Zangl



    The main problem is that the plugin does not find the correct attachmentfile. This needs to be the original file name.

    The main line is this regexp:

    Replace it with:

    You can test it here:
    (use the full file path as pattern)

    Does it work now?

    No it’s not. and I fear this is working as designed.
    4 => ‘-50×50’,
    ‘x’ => ’50’,
    5 => ’50’,
    ‘y’ => ’50’,
    6 => ’50’,
    I think you are using “x” and “y” as well as “ext” for further processing. the stupid naming of the uploaded image will always lead you to a “don’t know what to do” situation. even scanning meta sizes won’t help:
    This is no full size image. Scanning meta sizes: Array ( [width] => 4000 [height] => 3000 [file] => 2016/04/tolles-bild-50×50.jpg [sizes] => Array ( [thumbnail] => Array ( [file] => tolles-bild-50×50-150×150.jpg [width] => 150 [height] => 150 [mime-type] => image/jpeg…….

    suggest 2 options 🙂 :

    1. documentation change: never upload an image named bla-30×30.[png|jpg]
    2. using another way to find the dimensions of the image so your calculation for the watermark sizing and probably other things can be done properly.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘New Uploaded Pics are not show anymore WP4.5’ is closed to new replies.