ER-Diagram for Users, Images and Likes

I’m looking to create a database (using Django) where:

  • A user uploads photos.
  • A user upvotes/downvotes photos of other users.

I came up with this ER diagram: enter image description here

My questions are:

  • Is a vote better as an entity or as an attribute of the photo?
  • If a vote should remain an entity, how do I show in its attributes that the primary key of the vote is the combined foreign keys of the user and the photo?

Any constructive comments/recommendations are also welcome.

Automatically add Link Images to Posts in WordPress if has not linked before or has specified class

I use this code to Automatically add Link Images to Posts in WordPress.

function wpguy_linked_image($  content){ if (is_single() === TRUE){ $  searchfor = '/(<img[^>]*\/>)/';   $  replacewith = '<a target="_blank" href="'.get_permalink().'">$  1</a>'; { $  content = preg_replace($  searchfor, $  replacewith, $  content); } } return $  content; } add_filter('the_content', 'wpguy_linked_image'); 

How can I add a condition that if the img tags are already linked or have class="no link me" , they will be excluded from linking?

Post Images URL in Bootstrap Carousel

So i made a blog with some posts, that contain a few images that i want to show in a carousel using Bootstrap. Right now, my code gets all the images and their URL’s and i want to use those URL’s in the image sources. The problem now is that the images do show, but half on top of eachother. I think the problem is in html in the foreach because they both have the "active" tag

Anybody has a better way to show these images in a carousel? Let me know

<link rel="stylesheet" href="" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">                                          <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">                       <ol class="carousel-indicators">                         <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>                         <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>                         <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>                       </ol>                       <div class="carousel-inner">                           <?php                                                                                    $  attachments = get_attached_media('image', get_the_ID());                             foreach ($  attachments as $  image) {                                 $  full_img_url = wp_get_attachment_url($  attachment->ID);                                 ?>                                 <div class="carousel-item active">                                   <img class="d-block w-100" src="<?php echo wp_get_attachment_url($  image->ID); ?>" alt="First slide">                                 </div>                           <?php                                                        }                           ?>                                                <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">                         <span class="carousel-control-prev-icon" aria-hidden="true"></span>                         <span class="sr-only">Previous</span>                       </a>                       <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">                         <span class="carousel-control-next-icon" aria-hidden="true"></span>                         <span class="sr-only">Next</span>                       </a>                     </div> 

How Can I Append Inline Style to Post Images in WordPress

Simple problem, not sure where to start.

Posts on our website get pulled into an RSS feed and get automatically emailed by an email service. This works perfectly great, except for one thing — normal web size images make our emailed posts look bad on mobile — the images render too big and make the email too wide, such that the text reduces to a smaller size.

I need to add an inline style to uploaded post images:

style="max-width: 100px; max-height: auto;" 

This forces any image to be restricted to the width of the div into which we put the content.

I don’t care if the style tag gets added to the images in the post on the website or in the RSS feed, but it needs to be there or it ruins the emailed post on mobile. When I add the style inline myself, it causes the email look great in a mobile display.

Any thoughts on how I can inject this inline style?

Display images that are not in the content

The function below returns all the images attached to the post, however, if I delete the image inserted into the content, it still returns in the function, because the media is still as attached to the post.

So, how do I really bring only the images inserted in the content of the post?

<?php  $  args = array(         'post_type'   => 'attachment',         'posts_per_page' => -1,         'post_mime_type' => 'image',         'post_parent' => $  post->ID,     );      $  attachments = get_posts( $  args );      if ( $  attachments ) {          foreach ( $  attachments as $  attachment ) {              echo wp_get_attachment_image( $  attachment->ID, false );             echo '<hr>';             echo '<br>';          }     } ?> 

How to remove images from my plugin page in WP Directory?

I can’t understand why, but I can’t rid of old (unnecessary) screenshots of my plugin in WP Directory.

I’ve remove assets folder from each version in tags, remove assets folder from trunk, made commit, but on the plugin’s page on WP Directory those images still here.

If I hover cursor over some unnecessary image – I’ll see hash of commit which firstly contain this image. How to rid of this image?

How can I use structured data for dynamically loaded images?

I have a webpage with a lot of images that I load dynamically onto the page dynamically using Javascript/JSON data.

The images’ rendered output is:

<li itemscope itemtype="">  <img src="$  {data.file}" alt="$  {data.alt}" itemprop='contentURL'> <div class="imageInfo">  <h2 itemprop="name">$  {}</h2>  </div>  </li> 

The schema structured data values I get from the JSON file are data.file for the itemprop="contentURL" and for the itemprop="name".

I have read that Google doesn’t use dynamically loaded schema markup unless you use JSON-LD. Currently when I test with Google’s structured data testing tool I see that the test shows there’s no structured data for my dynamically loaded content.

What are the steps I need to take to make sure that Google uses/sees my dynamically loaded structured data?

How to delete all the resized images without plugin

Images on my wordpress site are talking 1.4 gb space. I’m sure Used Original images space is not more than 300-400mb. So i want to remove resized images so my site’s backup can be light. i used many image cleaner plugins and only 100mb space reduced. At the end when i checked upload folder in file manager i’m still seeing resized images for every original image. Any new working method ? Thanks