Quickly Remove Images From Imagearn.com Galleries [php script]

As is typical of my work, this is quick and dirty but it gets the job done.  Use at your own risk.  However, it works great for me.

You’ll need a web server with PHP that has the curl extension installed.  By the way, my current browser is Chrome.

Make sure you’re logged into Imagearn.com when you use it.   Their login sessions last for 30 minutes or so, or if you close your browser, so verify before you run this script.  Nothing bad will happen if you’re not logged in at the time, only that the images you try to remove *won’t* be removed.

Note: this script can be tweaked in tons of ways, and I may get around to it, but don’t hold your breath.  Better off tweaking it yourself.

First, after logging into imagearn.com, go to Edit the gallery that has the images you want to remove.

Then click on Remove Images.

Right-click on that page somewhere and select “View Source” or your browser’s equivalent option.

Copy the page’s source code.

Now browse to the PHP script.

In the textarea field, paste the source code.

Click Submit.

(Sometimes I have to click it again.)

A vertical list of thumbnails and links will appear below the textarea field.  Middle-clicking either will immediately and permanently delete the related image by open up a properly formatted URL in a new background tab.

NOTE: You MUST MIDDLE-CLICK (open the links in a new tab) when clicking a thumbnail or the word ‘remove’.  The link target is not ‘_blank’, because if it was set to ‘_blank’ then the current page will lose focus, and the whole point of me making this would be defeated.  Middle-click opens them in a background tab (for me, at any rate).  This allows me to middle-click through, staying on the same page, and getting rid of images must faster than via the means provided by Imagearn.com which forces you to confirm the removal.  This is very time-consuming if you have alot of images to remove.

I had an enhanced script that would allow you to toggle a bunch of checkboxes at once from a point in the list, then use javascript to open a bunch of tabs with the correct links but the script disappeared from my local server (which is actually my motivation for putting this on the web).

<?php

foreach($_GET as $k => $v) {
	$$k = $_GET[$k];	
}

foreach($_POST as $k => $v) {
	$$k = $_POST[$k];	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>remove from imagearn gallery</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <label>
    <textarea name="source" id="source" cols="100" rows="20"><?php print stripslashes($source); ?></textarea>
  </label>
  <label>
    <input type="submit" name="button" id="button" value="Submit" />
  </label>
  <input name="action" type="hidden" id="action" value="sbt" />
</form><br />
<br />
<?php 
if ($action == "sbt") {
	preg_match_all("|profile.php?o=remove_images&id=([0-9]+)&idimg=([0-9]+)"[^>]+>[^<]*<img src="([^"]+)"|i",stripslashes($source),$matches);
	foreach($matches[1] as $k => $v) {
		$thumb = $matches[3][$k];
		$f = $v;
		$s = $matches[2][$k];
		$rlink = "http://imagearn.com/profile.php?o=remove_images&id=$f&idimg=$s&yes=yes";
		echo "<a href="$rlink" style="font-size:54px"><img src="$thumb"> remove</a><br>";
	}
}
?>
</body>
</html>

Leave a comment

You must be logged in to post a comment.