• Greetings,

    I am relatively new to both WordPress and WP Data Access so apology in advance if I make a fundamental mistake.

    For some time I have been collecting data in a MySQL/MariaDB including images automatically with a python script. Now I’m at a stage where I want to find more accessible ways to display and review the data and WP Data Access fulfilled almost all my requirements. The one exception is related to images.

    I currently save my images as BLOBs in my DB but I already learned that the WP media library doesn’t support images in DBs. It wouldn’t be too difficult to change my script so that it creates local jpg files. But how would I add and link all those images to WordPress and WP Data Access? The nature of these images is highly dynamic so I want to add and replace them automatically from the backend. Manually editing these images is not a solution.

    All examples I have seen, seem to use static image data so I was wondering if dynamic image data is a little bit outside the scope of this project or WordPress in general.

    Thanks in advance.
    Best regards,
    schattenan

    • This topic was modified 5 years, 11 months ago by schattenan.
    • This topic was modified 5 years, 11 months ago by schattenan.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi schattenan,

    Welcome to the forum! 🙂

    What exactly do you mean with “The nature of these images is highly dynamic so I want to add and replace them automatically from the backend.”? Do you mean the initial loading into the WordPress media library? Or do you want to edit and update these images constantly? What does your work flow look like?

    The plugin allows you to add and remove media to the WordPress media library and stores the media file references in a database table through a data entry form. There is no support for batch processing.

    Are you aware that files stored in your WordPress media library are directly accessible from outside? Also via ftp. If a user deletes a file with ftp that is in the WordPress media library, you’ll get a broken link. Blobs allow you to add your own “logic” (like permission handling). It gives you much more control.

    My thoughts… If your blob solution is working properly, why change…?

    Best regards,
    Peter

    Thread Starter schattenan

    (@schattenan)

    Hi Peter,
    thanks for your reply. I realized I need to be a little bit more specific about what I want to do.

    Or do you want to edit and update these images constantly? What does your workflow look like?

    Some of the images are graphs that are updated or generated every time my python script is triggered, which happens every day at midnight. The raw binary data of the resulting images are currently stored in a MySQL BLOB column (MEDIUMBLOB to be precise). Opening the BLOBS via phpMyAdmin manually works fine but I’m looking for a better solution to display the images and corresponding information.

    My thoughts… If your blob solution is working properly, why change…?

    My BLOB solution for images sadly doesn’t work. Within the Data Explorer, I can set my BLOB column to the image type (or leave it empty) but they aren’t displayed in WordPress (or the Data Explorer). My idea was to create (and update) jpg files in /wp-content/uploads/ and link them in some way to the database entries. But that requires tinkering with WordPress’s own databases (which probably is a bad idea).

    So I was wondering if my use case is a little bit beyond the scope of the Plugin or WordPress in general. Or maybe there is a straightforward solution and I’m just stupid.

    Best regards,
    schattenan

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi schattenan,

    Can you share your data model? And how you show your images on the web? I’m also interested in how you add media information to your images. You can use the contactform on the plugin website if you prefer to share this information in private.

    The plugin uses the WordPress media library to convert media IDs to URLs. If you want to store media in a blob, you don’t have a URL, so you’ll need to build a stream that returns the media. The plugin does not supports that kind of functionality. But it can be added! 🙂

    Sounds interesting to further investigate…

    Best regards,
    Peter

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Insert and update images with an external script’ is closed to new replies.