Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Necuima last won the day on June 13 2017

Necuima had the most liked content!

Community Reputation

15 Good

About Necuima

  • Rank
    Advanced Member

Recent Profile Visitors

958 profile views
  1. I had the same problem and I found that I had the BASE_URL set incorrectly in module config.inc.php Once I fixed that the activation script ran OK.
  2. In case you need to have both C++/Magick++ and Imagick on your PC (localhost), after much trial and error I found, with thanks to those who posted the guidances and data following, how to install it correctly. My environment is Windows 10 with the latest 64bit XAMPP from: https://www.apachefriends.org/download.html I installed XAMPP/PHP version 7.3.7. My development environment in this case is Visual Studio 2019 and Dreamweaver CS6. The primary guidance is from: https://herbmiller.me/installing-imagick-php-7/ with many thanks to this gentleman. But if you follow this exactly you will not have C++/Magick++ available. Regarding compatible Imagick dlls and ImageMagick versions, see also: https://mlocati.github.io/articles/php-windows-imagick.html with thanks to Michele. But again, the ImageMagick zips will not give you the C++/Magick++ headers or sub-directories. For that you need to do the ImageMagick install from an exe and you can get this from: https://ftp.icm.edu.pl/packages/ImageMagick/binaries/ with many thanks to that institution. You need to select the C and C++ headers option as well as the legacy option during the installation. You need to be extremely careful to install the correct/compatible versions in all cases as advised in Herb Miller's post. By following this guidance exactly I managed to get one installation of ImageMagick with the PHP/Imagick and Magick++ functionality available. Cheers
  3. The MFC form does not use .NET whereas the VS2015/19 standard form constructs use .NET and that was what was preventing the cpprestsdk (Casablanca) communication with the back-end server on localhost. At least that is how I understand it. Again, just FYI. Cheers
  4. Hi Larry, back in April I was looking for a way for a C++ front-end to 'communicate' with a PHP back-end with all functionality being on one PC? I.e., the implementation of PHP in my case would be via XAMPP. On April 21st I reported that I had tried to use cpprestsdk (Casablanca) with a Windows Form via Visual Studio but that did not work. But today I managed to get the functionality to work perfectly by developing the form with Microsoft Foundation Classes (MFC) which I had never used before :-) That took over 2 months - just as well that I am retired and have the time (and perseverance :-) The IDE was VS2015/19 Community Editions. Just FYI, Cheers
  5. Hi Larry, Thanks as always for your interest and advice. As an aside I had not used FLEX/WindowedApplication for a few years so I was a bit rusty but all OK again now. Referred to your FLEX and AIR books both of which I have. I now have the application working just fine on both Win7/PHP 5.6 and on a separate computer with Win 10 and PHP 7.1 Cheers from Oz, Necuima
  6. P.S., The Flash program is a windowed FLEX application and as mentioned, this works perfectly with the called PHP scripts on XAMPP.
  7. Hi Larry, I am missing something. I select a file or a directory on my PC in a PHP script which includes an HTML form and within the form I use upload. Then on the redux pass I can move that file to a server location and do some stuff with it. No problem. But what I want to do is do some stuff to the file on the PC which I can do if I know the full path of the selected file. And in a slightly different PHP script I want to select a directory on my PC and get its full path so that I can then iterate over the files therein and do stuff to them. What am I missing? And thank you as always. Cheers P.S., using a C++ front end or a Flash front-end program I can get the full path names of files and directories on my PC. Then, at least the Flash case, I can pass those data to a PHP back-end which nicely does what I want it to do for those selected files on my PC. I do not want this functionality for files on an external web-server.
  8. Hi Larry, FYI I installed cpprestsdk and associated it with Visual Studio 2019 and yes, a test C++ program successfully called and received a response from an external website. BUT (isn't there often a BUT) when I tried to integrate the code that uses cpprestsdk into a Windows form application, I found out that they are incompatible! Well, it was an interesting learning exercise :-) As an aside, I found it quite tricky to install cpprestsdk but carefully following guidance courtesy Dr Google I eventually managed to get it installed and working with VS2019 (but not VS2017) in a Windows 10 PC. Thanks for your interest.
  9. Hi Larry, Yes, I can access the contents of a file but can I get access to its full path - the application will be running on my PC with PHP via localhost/XAMPP? Thanks, Necuima
  10. Hi Larry, I want the front end to be C++ so that I have access to the PC file system. Apparently it can be done with cpprestsdk and I will check it out. I wonder if I could do it the other way around with PHP on the server calling a C++ module on my PC to get access to the PC file system? I want to access a directory on the PC which, apparently cannot be done with PHP or an HTML form. I want the full path of the directory, not an upload. Re being comfortable with PHP - yes you are right on that count but I'm learning a lot more of C++ particularly using Visual Studio as the IDE which has nice PC forms functionality. Thanks for your reply. Cheers
  11. That should be "I did something like this a few years ago with Adobe AIR and FLEX....". leveraging both your AIR and FLEX books. Cheers
  12. Hi Larry, Is it possible to have a Windows Form in C++ 'communicate' with a PHP back-end with all functionality being on one PC? I.e., the implementation of PHP in my case would be via XAMPP. Specifically I'd like to have a C++ Windows Form as that has access to the PC file system, and then pass some data from the PC file system to a PHP back-end which would do some work on the file passed to it. Once the work was done then some communication back to the Windows Form front-end to say that the work had been done. I did something like this a few years ago with Adobe AIR as the front-end and PHP as the back end, but would now like to do something similar but with the Windows Form C++ as the font-end. Looking forward to your advice. Cheers from Oz.
  13. To avoid compiler warnings change the following: Change 'char jpg_signature' to 'unsigned char jpg_signature' and 'char buff[12]' to 'unsigned char buff[12]'. Tested and still works correctly. The method should probably be named 'checkMimeType'. Cheers
  14. Here's some C++ to check if a file is of MIME type 'image/jpeg'. private: String^ GetMimeType(String^ FileName) { // MessageBox::Show("GetMimeType called with " + FileName); const unsigned short JPG_SIGNATURE_LENGTH = 3; char jpg_signature[JPG_SIGNATURE_LENGTH] = { 255, 216, 255 }; // an array of chars with the 'signature' for jpg files char buff[12]; // create a buffer for the first 12 bytes of the file // convert managed string FileName to a standard string // ifstream expects a pointer to a C string (array) of chars char* InputFileName = (char*)Marshal::StringToHGlobalAnsi(FileName).ToPointer(); std::ifstream fileInput(InputFileName, std::ios::binary); // opens the file as a binary file if (fileInput.is_open()) { // MessageBox::Show("fileInput is open for " + FileName); fileInput.read(reinterpret_cast<char *>(&buff), sizeof(buff)); // read the first 12 bytes of the binary input file // now compare the first three bytes for (int i = 0; i < JPG_SIGNATURE_LENGTH; i++) { if (jpg_signature[i] != buff[i]) { fileInput.close(); return "Not jpeg"; // this will break the for loop and exit the method } } // end for loop // the first 3 bytes matched the 'signature' for a jpeg file fileInput.close(); return "image/jpeg"; } else { MessageBox::Show("fileInput open failed for " + FileName); } } // end GetMimeType This is a combination of Visual Studio managed C++ and standard C++. The path of the file is passed to the method. It may be of interest to someone. Cheers from Oz.
  15. Hi Larry, Now have it working with a Visual Studio 2017 C++ front-end using the same C sharp DLL. It is very similar. The changes are: using namespace FileTypesLib; FileTypes^ fileTypes = gcnew FileTypes(); if (openFileDialog1->ShowDialog() != System::Windows::Forms::DialogResult::Yes) { // weird!! The negative case is the one that works?? String^ theFileName = openFileDialog1->FileName; // save the file name in the text box this->txtSelectedFile->Text = theFileName; // get the MIME type and save it in the form text box txtMIMEType->Text = fileTypes->GetMimeType(theFileName); } Again, it may be of interest to someone. Cheers
  • Create New...