Asked  2 Years ago    Answers:  5   Viewed   39 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

3

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

Thursday, October 6, 2022
 
aaadi
 
2

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();
Sunday, August 21, 2022
2

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


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.

Sunday, December 11, 2022
 
3

Use this tag:

<meta http-equiv="X-UA-Compatible" content="IE=8" />
Wednesday, August 31, 2022
5
  • 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 7, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages