Asked  7 Months ago    Answers:  5   Viewed   24 times

The scenario is: when a user upload a image, we do image resizing on the server, but instead of waiting for this job done, I want it to response to the user immediately. if there is a thread available, I would properly just use thread to do this task, but as far as I know , there is no thread in php, so how can I achieve this goal? Thanks for ideas and suggestions.

 Answers

96

Either fork the process (ugly and unreliable) or use a JobQueue, like Gearman.

Wednesday, March 31, 2021
 
devo
answered 7 Months ago
44

The argument of the Imagick constructor is to load a local image file. To load a remote image file, you should instantiate an Imagick object without arguments and either:

  • download the image content and pass it to the readImageBlob method, or
  • fopen the URL and pass it to the readImageFile method.

For example:

// assuming $image is an URL or path to a local file
$handle = fopen($image, 'rb');
$im2 = new Imagick();
$im2->readImageFile($handle);
$im2->setImageFormat("tiff");
$im2->setImageColorSpace(5);
$im2->writeImage("test.tiff");
fclose($handle);
$im2->destroy();
Saturday, May 29, 2021
 
Teno
answered 5 Months ago
93

Given all your data downloaded to my computer, I can convert it to png using ImageMagick 6.9.10.82 Q16 Mac OSX Sierra that calls Inkscape 0.92.4 as the SVG renderer.

convert right.inside.svg x.png


enter image description here

You have not shown the correct result. So I do not know if this is correct or not. But it does appear to be correct given the images in the assets folder.

However, the mask and other image needs to be accessible from whomever is trying to view the svg file. So either the data needs to be downloaded or perhaps you need to provide the URL to those files on some server that has the svg file.

Saturday, May 29, 2021
 
kwichz
answered 5 Months ago
43

I don't know if it applies to newer versions of Windows, but the .toFront() method used to flash the window if none of the current VM's windows were in the foreground.

This means that calling frame.toFront() on a minimized frame would always make it flash...

Tuesday, July 6, 2021
 
erotsppa
answered 4 Months ago
95
  • This CodeProject comment does it by simulating key presses
  • Vista+ has API to do this, with ShowDeskBand and HideDeskBand
  • Edit: This code can now Add a deskband object (from Pinvoke.net, and these two MSDN forum questions):

    [ComImport]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("4CF504B0-DE96-11D0-8B3F-00A0C911E8E5")]
    public interface IBandSite
    {
        [PreserveSig]
        uint AddBand([In, MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite);
        [PreserveSig]
        void RemoveBand(uint dwBandID);
    }
    
    
    private uint AddDeskbandToTray(Guid Deskband)
    {
        Guid IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}");
        Guid ITrayBand = new Guid("{F60AD0A0-E5E1-45cb-B51A-E15B9F8B2934}");   
        Type TrayBandSiteService = Type.GetTypeFromCLSID(ITrayBand, true);
        IBandSite BandSite = Activator.CreateInstance(TrayBandSiteService) as IBandSite;
        object DeskbandObject = CoCreateInstance(Deskband, null, CLSCTX.CLSCTX_INPROC_SERVER, IUnknown);
        return BandSite.AddBand(DeskbandObject);
    }
    

And, an example use:

Guid address_toolbar_guid = new Guid("{01E04581-4EEE-11D0-BFE9-00AA005B4383}");
uint band_id = AddDeskbandToTray(address_toolbar_guid);

It would make sense that a similar call to RemoveBand would also do the trick, but as of yet, I can't get that code to work. Another issue: the added deskband closes when the application that added it closes.

Sunday, August 15, 2021
 
CKing
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :