Page MenuHomePhabricator

Unable to drag images from a web browser into Remarkup
Closed, DuplicatePublic

Description

You can drag and drop images into remarkup areas, but only from the desktop (and from some browsers, the clipboard). We should either support also dragging in from other web browsers, or not pretend that we support it.


I just found the following in my logfile, after trying to upload a Conpherence image from within the website itself (i.e. dragging and dropping an image from my Phabricator instance website into the upload field of Conpherence, without saving it locally)

PHP message: [2015-05-05 19:11:16] ERROR 2: imagecreatefromstring(): Data is not in a recognized format at [/opt/phabricator/phabricator/src/applications/files/PhabricatorImageTransformer.php:198]
PHP message: arcanist(head=master, ref.master=8919a9c5b55e), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=master, ref.master=92d399d086c9), phutil(head=master, ref.master=cb8cdccb1a50), sprint(head=master, ref.master=53f16c2f6fa0)
PHP message:   #0 imagecreatefromstring(string) called at [<phabricator>/src/applications/files/PhabricatorImageTransformer.php:198]
PHP message:   #1 PhabricatorImageTransformer::getPreviewDimensions(PhabricatorFile, integer) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:112]
PHP message:   #2 PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:47]
PHP message:   #3 PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:114]
PHP message:   #4 PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:368]
PHP message:   #5 PhabricatorObjectRemarkupRule::didMarkupText() called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:292]
PHP message:   #6 PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
PHP message:   #7 PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/conpherence/ConpherenceTransactionRenderer.php:59]
PHP message:   #8 ConpherenceTransactionRenderer::renderTransactions(PhabricatorUser, ConpherenceThread, boolean, string) called at [<phabricator>/src/applications/conpherence/controller/ConpherenceViewController.php:70]
PHP message:   #9 ConpherenceViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:218]
PHP message:   #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:132]
PHP message:   #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]
PHP message: [2015-05-05 19:11:16] ERROR 2: imagesx() expects parameter 1 to be resource, boolean given at [/opt/phabricator/phabricator/src/applications/files/PhabricatorImageTransformer.php:200]
PHP message: arcanist(head=master, ref.master=8919a9c5b55e), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=master, ref.master=92d399d086c9), phutil(head=master, ref.master=cb8cdccb1a50), sprint(head=master, ref.master=53f16c2f6fa0)
PHP message:   #0 imagesx(boolean) called at [<phabricator>/src/applications/files/PhabricatorImageTransformer.php:200]
PHP message:   #1 PhabricatorImageTransformer::getPreviewDimensions(PhabricatorFile, integer) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:112]
PHP message:   #2 PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:47]
PHP message:   #3 PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:114]
PHP message:   #4 PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:368]
PHP message:   #5 PhabricatorObjectRemarkupRule::didMarkupText() called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:292]
PHP message:   #6 PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
PHP message:   #7 PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/conpherence/ConpherenceTransactionRenderer.php:59]
PHP message:   #8 ConpherenceTransactionRenderer::renderTransactions(PhabricatorUser, ConpherenceThread, boolean, string) called at [<phabricator>/src/applications/conpherence/controller/ConpherenceViewController.php:70]
PHP message:   #9 ConpherenceViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:218]
PHP message:   #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:132]
PHP message:   #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]
PHP message: [2015-05-05 19:11:16] ERROR 2: imagesy() expects parameter 1 to be resource, boolean given at [/opt/phabricator/phabricator/src/applications/files/PhabricatorImageTransformer.php:201]
PHP message: arcanist(head=master, ref.master=8919a9c5b55e), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=master, ref.master=92d399d086c9), phutil(head=master, ref.master=cb8cdccb1a50), sprint(head=master, ref.master=53f16c2f6fa0)
PHP message:   #0 imagesy(boolean) called at [<phabricator>/src/applications/files/PhabricatorImageTransformer.php:201]
PHP message:   #1 PhabricatorImageTransformer::getPreviewDimensions(PhabricatorFile, integer) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:112]
PHP message:   #2 PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:47]
PHP message:   #3 PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:114]
PHP message:   #4 PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:368]
PHP message:   #5 PhabricatorObjectRemarkupRule::didMarkupText() called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:292]
PHP message:   #6 PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
PHP message:   #7 PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/conpherence/ConpherenceTransactionRenderer.php:59]
PHP message:   #8 ConpherenceTransactionRenderer::renderTransactions(PhabricatorUser, ConpherenceThread, boolean, string) called at [<phabricator>/src/applications/conpherence/controller/ConpherenceViewController.php:70]
PHP message:   #9 ConpherenceViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:218]
PHP message:   #10 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:132]
PHP message:   #11 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]
PHP message: [2015-05-05 19:11:16] ERROR 2: Division by zero at [/opt/phabricator/phabricator/src/applications/files/PhabricatorImageTransformer.php:204]
PHP message: arcanist(head=master, ref.master=8919a9c5b55e), libphremot
[Tue May 05 19:11:16.662984 2015] [proxy_fcgi:error] [pid 26102] [client <…>] AH01071: Got error 'd=master, ref.master=53f16c2f6fa0)
PHP message:   #0 PhabricatorImageTransformer::getPreviewDimensions(PhabricatorFile, integer) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:112]
PHP message:   #1 PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:47]
PHP message:   #2 PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:114]
PHP message:   #3 PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:368]
PHP message:   #4 PhabricatorObjectRemarkupRule::didMarkupText() called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:292]
PHP message:   #5 PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
PHP message:   #6 PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/conpherence/ConpherenceTransactionRenderer.php:59]
PHP message:   #7 ConpherenceTransactionRenderer::renderTransactions(PhabricatorUser, ConpherenceThread, boolean, string) called at [<phabricator>/src/applications/conpherence/controller/ConpherenceViewController.php:70]
PHP message:   #8 ConpherenceViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:218]
PHP message:   #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:132]
PHP message:   #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]
PHP message: [2015-05-05 19:11:16] ERROR 2: Division by zero at [/opt/phabricator/phabricator/src/applications/files/PhabricatorImageTransformer.php:204]
PHP message: arcanist(head=master, ref.master=8919a9c5b55e), libphremoteuser(head=master, ref.master=1def4e2d7f07), phabricator(head=master, ref.master=92d399d086c9), phutil(head=master, ref.master=cb8cdccb1a50), sprint(head=master, ref.master=53f16c2f6fa0)
PHP message:   #0 PhabricatorImageTransformer::getPreviewDimensions(PhabricatorFile, integer) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:112]
PHP message:   #1 PhabricatorEmbedFileRemarkupRule::renderImageFile(PhabricatorFile, PhabricatorObjectHandle, array) called at [<phabricator>/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php:47]
PHP message:   #2 PhabricatorEmbedFileRemarkupRule::renderObjectEmbed(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:114]
PHP message:   #3 PhabricatorObjectRemarkupRule::renderObjectEmbedForAnyMedia(PhabricatorFile, PhabricatorObjectHandle, string) called at [<phabricator>/src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php:368]
PHP message:   #4 PhabricatorObjectRemarkupRule::didMarkupText() called at [<phutil>/src/markup/engine/PhutilRemarkupEngine.php:292]
PHP message:   #5 PhutilRemarkupEngine::postprocessText(array) called at [<phabricator>/src/infrastructure/markup/PhabricatorMarkupEngine.php:138]
PHP message:   #6 PhabricatorMarkupEngine::process() called at [<phabricator>/src/applications/conpherence/ConpherenceTransactionRenderer.php:59]
PHP message:   #7 ConpherenceTransactionRenderer::renderTransactions(PhabricatorUser, ConpherenceThread, boolean, string) called at [<phabricator>/src/applications/conpherence/controller/ConpherenceViewController.php:70]
PHP message:   #8 ConpherenceViewController::handleRequest(AphrontRequest) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:218]
PHP message:   #9 AphrontApplicationConfiguration::processRequest(AphrontRequest, PhutilDeferredLog, AphrontPHPHTTPSink, MultimeterControl) called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:132]
PHP message:   #10 AphrontApplicationConfiguration::runHTTPRequest(AphrontPHPHTTPSink) called at [<phabricator>/webroot/index.php:19]

On the site it did nothing, but apparently it created this error in the logfiles. Later I downloaded the image file and then uploaded it into the drag&drop area from a file manager, which did not create such an error and successfully uploaded the file.

Event Timeline

devurandom raised the priority of this task from to Needs Triage.
devurandom updated the task description. (Show Details)
devurandom added a project: Conpherence.
devurandom added a subscriber: devurandom.

Are you using two different browser windows to do this?

chad renamed this task from Conpherence image upload broken to Unable to drag images from a web browser into Remarkup.May 5 2015, 5:45 PM
chad updated the task description. (Show Details)
chad edited projects, added Remarkup; removed Conpherence.

The upload image control is only available from main conpherence (/conpherence/*, /ZXXX) so the images available to drag and drop are few and are things like the logo and your profile picture.

If I drag and drop those from the browser to the desktop, I get some sort of text file like this:

This does seem to work correctly on big images like
Screen_Shot_2015-04-23_at_11.12.41_AM.png (1×1 px, 461 KB)
.

I think similarly its literally uploading such a text file and error'ing out in a blaze of glory?

You can also have other images in the thread via various remarkup wizardry as I did above. However, I am not sure how you can drag and drop those since the edit picture thing is a modal dialog and the underlying content is inaccessible?

I guess the possible bug here is the drag and drop should not be some sort of text file and instead be some sort of image for things like your profile picture or phabricator logo.

I posted this primarily, because there are some division by zero errors logged. I guess those could be fixed by improved error handling.

As to which image I dragged: It was a PNG image (project image) from the Phabricator Files application.

P.S: Destination was the conpherence room icon / image drag&drop field, not the message entry area.

T7186 seems like the correct fix, that is, properly detect what you are dropping and do the right thing. This is regardless of drag and drop field or Remarkup Textarea, it's all the same JS. Up to @btrahan if we should pursue better error handling in conjunction.